Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit aafff4a

Browse files
committed
Aix additions
1 parent f6943a9 commit aafff4a

File tree

6 files changed

+2235
-0
lines changed

6 files changed

+2235
-0
lines changed

src/template/.similar

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ powerpc-ibm-aix4.1=aix_41
2525
powerpc-ibm-aix4.2=aix_42
2626
powerpc-ibm-aix4.3=aix_42
2727
powerpc-unknown-linux-gnu=linux_ppc
28+
rs6000-ibm-aix4.2=aix_42
29+
rs6000-ibm-aix4.3=aix_42
2830
sparc-sun-solaris=solaris_sparc_gcc
2931
sparc-sun-sunos4=sunos4_gcc
3032
sparc-sun-sunos5=solaris_sparc_gcc
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
--
2+
-- ABSTIME
3+
-- testing built-in time type abstime
4+
-- uses reltime and tinterval
5+
--
6+
--
7+
-- timezones may vary based not only on location but the operating
8+
-- system. the main correctness issue is that the OS may not get
9+
-- daylight savings time right for times prior to Unix epoch (jan 1 1970).
10+
--
11+
CREATE TABLE ABSTIME_TBL (f1 abstime);
12+
INSERT INTO ABSTIME_TBL (f1) VALUES ('Jan 14, 1973 03:14:21');
13+
-- was INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'now'):
14+
INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'Mon May 1 00:30:30 1995');
15+
INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'epoch');
16+
INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'current');
17+
INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'infinity');
18+
INSERT INTO ABSTIME_TBL (f1) VALUES (abstime '-infinity');
19+
INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'May 10, 1947 23:59:12');
20+
-- what happens if we specify slightly misformatted abstime?
21+
INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 35, 1946 10:00:00');
22+
ERROR: Bad abstime external representation 'Feb 35, 1946 10:00:00'
23+
INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 28, 1984 25:08:10');
24+
ERROR: Bad abstime external representation 'Feb 28, 1984 25:08:10'
25+
-- badly formatted abstimes: these should result in invalid abstimes
26+
INSERT INTO ABSTIME_TBL (f1) VALUES ('bad date format');
27+
ERROR: Bad abstime external representation 'bad date format'
28+
INSERT INTO ABSTIME_TBL (f1) VALUES ('Jun 10, 1843');
29+
-- test abstime operators
30+
SELECT '' AS eight, ABSTIME_TBL.*;
31+
eight | f1
32+
-------+------------------------------
33+
| Sun Jan 14 03:14:21 1973 PST
34+
| Mon May 01 00:30:30 1995 PDT
35+
| epoch
36+
| current
37+
| infinity
38+
| -infinity
39+
| Sun May 11 00:59:12 1947 PDT
40+
| invalid
41+
(8 rows)
42+
43+
SELECT '' AS six, ABSTIME_TBL.*
44+
WHERE ABSTIME_TBL.f1 < abstime 'Jun 30, 2001';
45+
six | f1
46+
-----+------------------------------
47+
| Sun Jan 14 03:14:21 1973 PST
48+
| Mon May 01 00:30:30 1995 PDT
49+
| epoch
50+
| current
51+
| -infinity
52+
| Sun May 11 00:59:12 1947 PDT
53+
(6 rows)
54+
55+
SELECT '' AS six, ABSTIME_TBL.*
56+
WHERE ABSTIME_TBL.f1 > abstime '-infinity';
57+
six | f1
58+
-----+------------------------------
59+
| Sun Jan 14 03:14:21 1973 PST
60+
| Mon May 01 00:30:30 1995 PDT
61+
| epoch
62+
| current
63+
| infinity
64+
| Sun May 11 00:59:12 1947 PDT
65+
(6 rows)
66+
67+
SELECT '' AS six, ABSTIME_TBL.*
68+
WHERE abstime 'May 10, 1947 23:59:12' <> ABSTIME_TBL.f1;
69+
six | f1
70+
-----+------------------------------
71+
| Sun Jan 14 03:14:21 1973 PST
72+
| Mon May 01 00:30:30 1995 PDT
73+
| epoch
74+
| current
75+
| infinity
76+
| -infinity
77+
(6 rows)
78+
79+
SELECT '' AS one, ABSTIME_TBL.*
80+
WHERE abstime 'current' = ABSTIME_TBL.f1;
81+
one | f1
82+
-----+---------
83+
| current
84+
(1 row)
85+
86+
SELECT '' AS three, ABSTIME_TBL.*
87+
WHERE abstime 'epoch' >= ABSTIME_TBL.f1;
88+
three | f1
89+
-------+------------------------------
90+
| epoch
91+
| -infinity
92+
| Sun May 11 00:59:12 1947 PDT
93+
(3 rows)
94+
95+
SELECT '' AS four, ABSTIME_TBL.*
96+
WHERE ABSTIME_TBL.f1 <= abstime 'Jan 14, 1973 03:14:21';
97+
four | f1
98+
------+------------------------------
99+
| Sun Jan 14 03:14:21 1973 PST
100+
| epoch
101+
| -infinity
102+
| Sun May 11 00:59:12 1947 PDT
103+
(4 rows)
104+
105+
SELECT '' AS four, ABSTIME_TBL.*
106+
WHERE ABSTIME_TBL.f1 <?>
107+
tinterval '["Apr 1 1950 00:00:00" "Dec 30 1999 23:00:00"]';
108+
four | f1
109+
------+------------------------------
110+
| Sun Jan 14 03:14:21 1973 PST
111+
| Mon May 01 00:30:30 1995 PDT
112+
| epoch
113+
(3 rows)
114+
115+
-- these four queries should return the same answer
116+
-- the "infinity" and "-infinity" tuples in ABSTIME_TBL cannot be added and
117+
-- therefore, should not show up in the results.
118+
SELECT '' AS three, ABSTIME_TBL.*
119+
WHERE (ABSTIME_TBL.f1 + reltime '@ 3 year') -- +3 years
120+
< abstime 'Jan 14 14:00:00 1977';
121+
three | f1
122+
-------+------------------------------
123+
| Sun Jan 14 03:14:21 1973 PST
124+
| epoch
125+
| Sun May 11 00:59:12 1947 PDT
126+
(3 rows)
127+
128+
SELECT '' AS three, ABSTIME_TBL.*
129+
WHERE (ABSTIME_TBL.f1 + reltime '@ 3 year ago') -- -3 years
130+
< abstime 'Jan 14 14:00:00 1971';
131+
three | f1
132+
-------+------------------------------
133+
| Sun Jan 14 03:14:21 1973 PST
134+
| epoch
135+
| Sun May 11 00:59:12 1947 PDT
136+
(3 rows)
137+
138+
SELECT '' AS three, ABSTIME_TBL.*
139+
WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year') -- -(+3) years
140+
< abstime 'Jan 14 14:00:00 1971';
141+
three | f1
142+
-------+------------------------------
143+
| Sun Jan 14 03:14:21 1973 PST
144+
| epoch
145+
| Sun May 11 00:59:12 1947 PDT
146+
(3 rows)
147+
148+
SELECT '' AS three, ABSTIME_TBL.*
149+
WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year ago') -- -(-3) years
150+
< abstime 'Jan 14 14:00:00 1977';
151+
three | f1
152+
-------+------------------------------
153+
| Sun Jan 14 03:14:21 1973 PST
154+
| epoch
155+
| Sun May 11 00:59:12 1947 PDT
156+
(3 rows)
157+
158+
SELECT '' AS ten, ABSTIME_TBL.f1 AS abstime, RELTIME_TBL.f1 AS reltime
159+
WHERE (ABSTIME_TBL.f1 + RELTIME_TBL.f1)
160+
< abstime 'Jan 14 14:00:00 1971'
161+
ORDER BY abstime, reltime;
162+
ten | abstime | reltime
163+
-----+------------------------------+---------------
164+
| Sun May 11 00:59:12 1947 PDT | @ 14 secs ago
165+
| Sun May 11 00:59:12 1947 PDT | @ 1 min
166+
| Sun May 11 00:59:12 1947 PDT | @ 5 hours
167+
| Sun May 11 00:59:12 1947 PDT | @ 10 days
168+
| Sun May 11 00:59:12 1947 PDT | @ 3 mons
169+
| epoch | @ 14 secs ago
170+
| epoch | @ 1 min
171+
| epoch | @ 5 hours
172+
| epoch | @ 10 days
173+
| epoch | @ 3 mons
174+
(10 rows)
175+

0 commit comments

Comments
 (0)