Commit aafff4af authored by Bruce Momjian's avatar Bruce Momjian

Aix additions

parent f6943a9f
...@@ -25,6 +25,8 @@ powerpc-ibm-aix4.1=aix_41 ...@@ -25,6 +25,8 @@ powerpc-ibm-aix4.1=aix_41
powerpc-ibm-aix4.2=aix_42 powerpc-ibm-aix4.2=aix_42
powerpc-ibm-aix4.3=aix_42 powerpc-ibm-aix4.3=aix_42
powerpc-unknown-linux-gnu=linux_ppc powerpc-unknown-linux-gnu=linux_ppc
rs6000-ibm-aix4.2=aix_42
rs6000-ibm-aix4.3=aix_42
sparc-sun-solaris=solaris_sparc_gcc sparc-sun-solaris=solaris_sparc_gcc
sparc-sun-sunos4=sunos4_gcc sparc-sun-sunos4=sunos4_gcc
sparc-sun-sunos5=solaris_sparc_gcc sparc-sun-sunos5=solaris_sparc_gcc
......
--
-- ABSTIME
-- testing built-in time type abstime
-- uses reltime and tinterval
--
--
-- timezones may vary based not only on location but the operating
-- system. the main correctness issue is that the OS may not get
-- daylight savings time right for times prior to Unix epoch (jan 1 1970).
--
CREATE TABLE ABSTIME_TBL (f1 abstime);
INSERT INTO ABSTIME_TBL (f1) VALUES ('Jan 14, 1973 03:14:21');
-- was INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'now'):
INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'Mon May 1 00:30:30 1995');
INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'epoch');
INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'current');
INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'infinity');
INSERT INTO ABSTIME_TBL (f1) VALUES (abstime '-infinity');
INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'May 10, 1947 23:59:12');
-- what happens if we specify slightly misformatted abstime?
INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 35, 1946 10:00:00');
ERROR: Bad abstime external representation 'Feb 35, 1946 10:00:00'
INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 28, 1984 25:08:10');
ERROR: Bad abstime external representation 'Feb 28, 1984 25:08:10'
-- badly formatted abstimes: these should result in invalid abstimes
INSERT INTO ABSTIME_TBL (f1) VALUES ('bad date format');
ERROR: Bad abstime external representation 'bad date format'
INSERT INTO ABSTIME_TBL (f1) VALUES ('Jun 10, 1843');
-- test abstime operators
SELECT '' AS eight, ABSTIME_TBL.*;
eight | f1
-------+------------------------------
| Sun Jan 14 03:14:21 1973 PST
| Mon May 01 00:30:30 1995 PDT
| epoch
| current
| infinity
| -infinity
| Sun May 11 00:59:12 1947 PDT
| invalid
(8 rows)
SELECT '' AS six, ABSTIME_TBL.*
WHERE ABSTIME_TBL.f1 < abstime 'Jun 30, 2001';
six | f1
-----+------------------------------
| Sun Jan 14 03:14:21 1973 PST
| Mon May 01 00:30:30 1995 PDT
| epoch
| current
| -infinity
| Sun May 11 00:59:12 1947 PDT
(6 rows)
SELECT '' AS six, ABSTIME_TBL.*
WHERE ABSTIME_TBL.f1 > abstime '-infinity';
six | f1
-----+------------------------------
| Sun Jan 14 03:14:21 1973 PST
| Mon May 01 00:30:30 1995 PDT
| epoch
| current
| infinity
| Sun May 11 00:59:12 1947 PDT
(6 rows)
SELECT '' AS six, ABSTIME_TBL.*
WHERE abstime 'May 10, 1947 23:59:12' <> ABSTIME_TBL.f1;
six | f1
-----+------------------------------
| Sun Jan 14 03:14:21 1973 PST
| Mon May 01 00:30:30 1995 PDT
| epoch
| current
| infinity
| -infinity
(6 rows)
SELECT '' AS one, ABSTIME_TBL.*
WHERE abstime 'current' = ABSTIME_TBL.f1;
one | f1
-----+---------
| current
(1 row)
SELECT '' AS three, ABSTIME_TBL.*
WHERE abstime 'epoch' >= ABSTIME_TBL.f1;
three | f1
-------+------------------------------
| epoch
| -infinity
| Sun May 11 00:59:12 1947 PDT
(3 rows)
SELECT '' AS four, ABSTIME_TBL.*
WHERE ABSTIME_TBL.f1 <= abstime 'Jan 14, 1973 03:14:21';
four | f1
------+------------------------------
| Sun Jan 14 03:14:21 1973 PST
| epoch
| -infinity
| Sun May 11 00:59:12 1947 PDT
(4 rows)
SELECT '' AS four, ABSTIME_TBL.*
WHERE ABSTIME_TBL.f1 <?>
tinterval '["Apr 1 1950 00:00:00" "Dec 30 1999 23:00:00"]';
four | f1
------+------------------------------
| Sun Jan 14 03:14:21 1973 PST
| Mon May 01 00:30:30 1995 PDT
| epoch
(3 rows)
-- these four queries should return the same answer
-- the "infinity" and "-infinity" tuples in ABSTIME_TBL cannot be added and
-- therefore, should not show up in the results.
SELECT '' AS three, ABSTIME_TBL.*
WHERE (ABSTIME_TBL.f1 + reltime '@ 3 year') -- +3 years
< abstime 'Jan 14 14:00:00 1977';
three | f1
-------+------------------------------
| Sun Jan 14 03:14:21 1973 PST
| epoch
| Sun May 11 00:59:12 1947 PDT
(3 rows)
SELECT '' AS three, ABSTIME_TBL.*
WHERE (ABSTIME_TBL.f1 + reltime '@ 3 year ago') -- -3 years
< abstime 'Jan 14 14:00:00 1971';
three | f1
-------+------------------------------
| Sun Jan 14 03:14:21 1973 PST
| epoch
| Sun May 11 00:59:12 1947 PDT
(3 rows)
SELECT '' AS three, ABSTIME_TBL.*
WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year') -- -(+3) years
< abstime 'Jan 14 14:00:00 1971';
three | f1
-------+------------------------------
| Sun Jan 14 03:14:21 1973 PST
| epoch
| Sun May 11 00:59:12 1947 PDT
(3 rows)
SELECT '' AS three, ABSTIME_TBL.*
WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year ago') -- -(-3) years
< abstime 'Jan 14 14:00:00 1977';
three | f1
-------+------------------------------
| Sun Jan 14 03:14:21 1973 PST
| epoch
| Sun May 11 00:59:12 1947 PDT
(3 rows)
SELECT '' AS ten, ABSTIME_TBL.f1 AS abstime, RELTIME_TBL.f1 AS reltime
WHERE (ABSTIME_TBL.f1 + RELTIME_TBL.f1)
< abstime 'Jan 14 14:00:00 1971'
ORDER BY abstime, reltime;
ten | abstime | reltime
-----+------------------------------+---------------
| Sun May 11 00:59:12 1947 PDT | @ 14 secs ago
| Sun May 11 00:59:12 1947 PDT | @ 1 min
| Sun May 11 00:59:12 1947 PDT | @ 5 hours
| Sun May 11 00:59:12 1947 PDT | @ 10 days
| Sun May 11 00:59:12 1947 PDT | @ 3 mons
| epoch | @ 14 secs ago
| epoch | @ 1 min
| epoch | @ 5 hours
| epoch | @ 10 days
| epoch | @ 3 mons
(10 rows)
This diff is collapsed.
This diff is collapsed.
--
-- TINTERVAL
--
CREATE TABLE TINTERVAL_TBL (f1 tinterval);
INSERT INTO TINTERVAL_TBL (f1)
VALUES ('["-infinity" "infinity"]');
INSERT INTO TINTERVAL_TBL (f1)
VALUES ('["May 10, 1947 23:59:12" "Jan 14, 1973 03:14:21"]');
INSERT INTO TINTERVAL_TBL (f1)
VALUES ('["Sep 4, 1983 23:59:12" "Oct 4, 1983 23:59:12"]');
INSERT INTO TINTERVAL_TBL (f1)
VALUES ('["epoch" "Mon May 1 00:30:30 1995"]');
INSERT INTO TINTERVAL_TBL (f1)
VALUES ('["Feb 15 1990 12:15:03" "current"]');
-- badly formatted tintervals
INSERT INTO TINTERVAL_TBL (f1)
VALUES ('["bad time specifications" ""]');
ERROR: Bad abstime external representation 'bad time specifications'
INSERT INTO TINTERVAL_TBL (f1)
VALUES ('["" "infinity"]');
ERROR: Bad abstime external representation ''
-- test tinterval operators
SELECT '' AS five, TINTERVAL_TBL.*;
five | f1
------+-----------------------------------------------------------------
| ["-infinity" "infinity"]
| ["Sun May 11 00:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"]
| ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
| ["epoch" "Mon May 01 00:30:30 1995 PDT"]
| ["Thu Feb 15 12:15:03 1990 PST" "current"]
(5 rows)
-- length ==
SELECT '' AS one, t.*
FROM TINTERVAL_TBL t
WHERE t.f1 #= '@ 1 months';
one | f1
-----+-----------------------------------------------------------------
| ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
(1 row)
-- length <>
SELECT '' AS three, t.*
FROM TINTERVAL_TBL t
WHERE t.f1 #<> '@ 1 months';
three | f1
-------+-----------------------------------------------------------------
| ["Sun May 11 00:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"]
| ["epoch" "Mon May 01 00:30:30 1995 PDT"]
| ["Thu Feb 15 12:15:03 1990 PST" "current"]
(3 rows)
-- length <
SELECT '' AS zero, t.*
FROM TINTERVAL_TBL t
WHERE t.f1 #< '@ 1 month';
zero | f1
------+----
(0 rows)
-- length <=
SELECT '' AS one, t.*
FROM TINTERVAL_TBL t
WHERE t.f1 #<= '@ 1 month';
one | f1
-----+-----------------------------------------------------------------
| ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
(1 row)
-- length >
SELECT '' AS three, t.*
FROM TINTERVAL_TBL t
WHERE t.f1 #> '@ 1 year';
three | f1
-------+-----------------------------------------------------------------
| ["Sun May 11 00:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"]
| ["epoch" "Mon May 01 00:30:30 1995 PDT"]
| ["Thu Feb 15 12:15:03 1990 PST" "current"]
(3 rows)
-- length >=
SELECT '' AS three, t.*
FROM TINTERVAL_TBL t
WHERE t.f1 #>= '@ 3 years';
three | f1
-------+-----------------------------------------------------------------
| ["Sun May 11 00:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"]
| ["epoch" "Mon May 01 00:30:30 1995 PDT"]
| ["Thu Feb 15 12:15:03 1990 PST" "current"]
(3 rows)
-- overlaps
SELECT '' AS three, t1.*
FROM TINTERVAL_TBL t1
WHERE t1.f1 &&
tinterval '["Aug 15 14:23:19 1983" "Sep 16 14:23:19 1983"]';
three | f1
-------+-----------------------------------------------------------------
| ["-infinity" "infinity"]
| ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
| ["epoch" "Mon May 01 00:30:30 1995 PDT"]
(3 rows)
SET geqo TO 'off';
SELECT '' AS five, t1.f1, t2.f1
FROM TINTERVAL_TBL t1, TINTERVAL_TBL t2
WHERE t1.f1 && t2.f1 and
t1.f1 = t2.f1
ORDER BY t1.f1, t2.f1;
five | f1 | f1
------+-----------------------------------------------------------------+-----------------------------------------------------------------
| ["-infinity" "infinity"] | ["-infinity" "infinity"]
| ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
| ["Thu Feb 15 12:15:03 1990 PST" "current"] | ["Thu Feb 15 12:15:03 1990 PST" "current"]
| ["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"]
| ["Sun May 11 00:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"] | ["Sun May 11 00:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"]
(5 rows)
SELECT '' AS fourteen, t1.f1 AS interval1, t2.f1 AS interval2
FROM TINTERVAL_TBL t1, TINTERVAL_TBL t2
WHERE t1.f1 && t2.f1 and not t1.f1 = t2.f1
ORDER BY interval1, interval2;
fourteen | interval1 | interval2
----------+-----------------------------------------------------------------+-----------------------------------------------------------------
| ["-infinity" "infinity"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
| ["-infinity" "infinity"] | ["Thu Feb 15 12:15:03 1990 PST" "current"]
| ["-infinity" "infinity"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"]
| ["-infinity" "infinity"] | ["Sun May 11 00:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"]
| ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["-infinity" "infinity"]
| ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"]
| ["Thu Feb 15 12:15:03 1990 PST" "current"] | ["-infinity" "infinity"]
| ["Thu Feb 15 12:15:03 1990 PST" "current"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"]
| ["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["-infinity" "infinity"]
| ["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
| ["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["Thu Feb 15 12:15:03 1990 PST" "current"]
| ["epoch" "Mon May 01 00:30:30 1995 PDT"] | ["Sun May 11 00:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"]
| ["Sun May 11 00:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"] | ["-infinity" "infinity"]
| ["Sun May 11 00:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"] | ["epoch" "Mon May 01 00:30:30 1995 PDT"]
(14 rows)
-- contains
SELECT '' AS five, t1.f1
FROM TINTERVAL_TBL t1
WHERE not t1.f1 <<
tinterval '["Aug 15 14:23:19 1980" "Sep 16 14:23:19 1990"]'
ORDER BY t1.f1;
five | f1
------+-----------------------------------------------------------------
| ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
| ["Thu Feb 15 12:15:03 1990 PST" "current"]
| ["Sun May 11 00:59:12 1947 PDT" "Sun Jan 14 03:14:21 1973 PST"]
(3 rows)
-- make time interval
SELECT '' AS three, t1.f1
FROM TINTERVAL_TBL t1
WHERE t1.f1 &&
(abstime 'Aug 15 14:23:19 1983' <#>
abstime 'Sep 16 14:23:19 1983')
ORDER BY t1.f1;
three | f1
-------+-----------------------------------------------------------------
| ["-infinity" "infinity"]
| ["Sun Sep 04 23:59:12 1983 PDT" "Tue Oct 04 23:59:12 1983 PDT"]
| ["epoch" "Mon May 01 00:30:30 1995 PDT"]
(3 rows)
RESET geqo;
abstime/.*aix4=abstime-1947-PDT
abstime/alpha.*-dec-osf=abstime-solaris-1947 abstime/alpha.*-dec-osf=abstime-solaris-1947
abstime/i.86-pc-solaris=abstime-solaris-1947 abstime/i.86-pc-solaris=abstime-solaris-1947
abstime/sparc-sun-solaris=abstime-solaris-1947 abstime/sparc-sun-solaris=abstime-solaris-1947
...@@ -16,7 +17,9 @@ geometry/hppa=geometry-positive-zeros ...@@ -16,7 +17,9 @@ geometry/hppa=geometry-positive-zeros
geometry/i.86-.*-gnulibc=geometry-i86-gnulibc geometry/i.86-.*-gnulibc=geometry-i86-gnulibc
geometry/i.86-pc-cygwin*=geometry-cygwin-precision geometry/i.86-pc-cygwin*=geometry-cygwin-precision
geometry/powerpc-unknown-linux-gnulibc1=geometry-powerpc-linux-gnulibc1 geometry/powerpc-unknown-linux-gnulibc1=geometry-powerpc-linux-gnulibc1
geometry/powerpc.*aix4=geometry-powerpc-aix4
geometry/sparc-sun-solaris=geometry-solaris-precision geometry/sparc-sun-solaris=geometry-solaris-precision
horology/.*aix4=horology-1947-PDT
horology/alpha.*-dec-osf=horology-solaris-1947 horology/alpha.*-dec-osf=horology-solaris-1947
horology/hppa=horology-no-DST-before-1970 horology/hppa=horology-no-DST-before-1970
horology/i.86-pc-solaris=horology-solaris-1947 horology/i.86-pc-solaris=horology-solaris-1947
...@@ -46,6 +49,7 @@ int4/i.86-pc-solaris=int4-too-large ...@@ -46,6 +49,7 @@ int4/i.86-pc-solaris=int4-too-large
int4/powerpc-unknown-linux-gnulibc1=int4-not-representable int4/powerpc-unknown-linux-gnulibc1=int4-not-representable
int4/sparc-sun-solaris=int4-too-large int4/sparc-sun-solaris=int4-too-large
int8/.*-qnx=int8-exp-three-digits int8/.*-qnx=int8-exp-three-digits
tinterval/.*aix4=tinterval-1947-PDT
tinterval/alpha.*-dec-osf=tinterval-solaris-1947 tinterval/alpha.*-dec-osf=tinterval-solaris-1947
tinterval/i.86-pc-solaris=tinterval-solaris-1947 tinterval/i.86-pc-solaris=tinterval-solaris-1947
tinterval/sparc-sun-solaris=tinterval-solaris-1947 tinterval/sparc-sun-solaris=tinterval-solaris-1947
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment