diff --git a/src/test/regress/expected/abstime-1947-PDT.out b/src/test/regress/expected/abstime-1947-PDT.out index 3075d13e6b..2ec8599d8a 100644 --- a/src/test/regress/expected/abstime-1947-PDT.out +++ b/src/test/regress/expected/abstime-1947-PDT.out @@ -112,64 +112,18 @@ SELECT '' AS four, ABSTIME_TBL.* | 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) +SELECT '' AS four, f1 AS abstime, + date_part('year', f1) AS year, date_part('month', f1) AS month, + date_part('day',f1) AS day, date_part('hour', f1) AS hour, + date_part('minute', f1) AS minute, date_part('second', f1) AS second + FROM ABSTIME_TBL + WHERE isfinite(f1) and f1 <> abstime 'current' + ORDER BY abstime; + four | abstime | year | month | day | hour | minute | second +------+------------------------------+------+-------+-----+------+--------+-------- + | Sun May 11 00:59:12 1947 PDT | 1947 | 5 | 11 | 0 | 59 | 12 + | epoch | 1969 | 12 | 31 | 16 | 0 | 0 + | Sun Jan 14 03:14:21 1973 PST | 1973 | 1 | 14 | 3 | 14 | 21 + | Mon May 01 00:30:30 1995 PDT | 1995 | 5 | 1 | 0 | 30 | 30 +(4 rows) diff --git a/src/test/regress/expected/abstime-solaris-1947.out b/src/test/regress/expected/abstime-solaris-1947.out index cca2519e91..efe333967d 100644 --- a/src/test/regress/expected/abstime-solaris-1947.out +++ b/src/test/regress/expected/abstime-solaris-1947.out @@ -112,64 +112,17 @@ SELECT '' AS four, ABSTIME_TBL.* | 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 - | Sat May 10 23: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 - | Sat May 10 23: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 - | Sat May 10 23: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 - | Sat May 10 23: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 ------+------------------------------+--------------- - | Sat May 10 23:59:12 1947 PDT | @ 14 secs ago - | Sat May 10 23:59:12 1947 PDT | @ 1 min - | Sat May 10 23:59:12 1947 PDT | @ 5 hours - | Sat May 10 23:59:12 1947 PDT | @ 10 days - | Sat May 10 23:59:12 1947 PDT | @ 3 mons - | epoch | @ 14 secs ago - | epoch | @ 1 min - | epoch | @ 5 hours - | epoch | @ 10 days - | epoch | @ 3 mons -(10 rows) - +SELECT '' AS four, f1 AS abstime, + date_part('year', f1) AS year, date_part('month', f1) AS month, + date_part('day',f1) AS day, date_part('hour', f1) AS hour, + date_part('minute', f1) AS minute, date_part('second', f1) AS second + FROM ABSTIME_TBL + WHERE isfinite(f1) and f1 <> abstime 'current' + ORDER BY abstime; + four | abstime | year | month | day | hour | minute | second +------+------------------------------+------+-------+-----+------+--------+-------- + | Sat May 10 23:59:12 1947 PDT | 1947 | 5 | 10 | 23 | 59 | 12 + | epoch | 1969 | 12 | 31 | 16 | 0 | 0 + | Sun Jan 14 03:14:21 1973 PST | 1973 | 1 | 14 | 3 | 14 | 21 + | Mon May 01 00:30:30 1995 PDT | 1995 | 5 | 1 | 0 | 30 | 30 +(4 rows) diff --git a/src/test/regress/expected/abstime.out b/src/test/regress/expected/abstime.out index a78b81652f..ddafc77ce0 100644 --- a/src/test/regress/expected/abstime.out +++ b/src/test/regress/expected/abstime.out @@ -112,64 +112,18 @@ SELECT '' AS four, ABSTIME_TBL.* | 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 - | Sat May 10 23:59:12 1947 PST -(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 - | Sat May 10 23:59:12 1947 PST -(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 - | Sat May 10 23:59:12 1947 PST -(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 - | Sat May 10 23:59:12 1947 PST -(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 ------+------------------------------+--------------- - | Sat May 10 23:59:12 1947 PST | @ 14 secs ago - | Sat May 10 23:59:12 1947 PST | @ 1 min - | Sat May 10 23:59:12 1947 PST | @ 5 hours - | Sat May 10 23:59:12 1947 PST | @ 10 days - | Sat May 10 23:59:12 1947 PST | @ 3 mons - | epoch | @ 14 secs ago - | epoch | @ 1 min - | epoch | @ 5 hours - | epoch | @ 10 days - | epoch | @ 3 mons -(10 rows) +SELECT '' AS four, f1 AS abstime, + date_part('year', f1) AS year, date_part('month', f1) AS month, + date_part('day',f1) AS day, date_part('hour', f1) AS hour, + date_part('minute', f1) AS minute, date_part('second', f1) AS second + FROM ABSTIME_TBL + WHERE isfinite(f1) and f1 <> abstime 'current' + ORDER BY abstime; + four | abstime | year | month | day | hour | minute | second +------+------------------------------+------+-------+-----+------+--------+-------- + | Sat May 10 23:59:12 1947 PST | 1947 | 5 | 10 | 23 | 59 | 12 + | epoch | 1969 | 12 | 31 | 16 | 0 | 0 + | Sun Jan 14 03:14:21 1973 PST | 1973 | 1 | 14 | 3 | 14 | 21 + | Mon May 01 00:30:30 1995 PDT | 1995 | 5 | 1 | 0 | 30 | 30 +(4 rows) diff --git a/src/test/regress/expected/horology-1947-PDT.out b/src/test/regress/expected/horology-1947-PDT.out index 3c5badd6b4..b04f877b87 100644 --- a/src/test/regress/expected/horology-1947-PDT.out +++ b/src/test/regress/expected/horology-1947-PDT.out @@ -694,20 +694,66 @@ SELECT '' as "54", d1 as timestamp, -- -- abstime, reltime arithmetic -- -SELECT '' AS four, f1 AS abstime, - date_part('year', f1) AS year, date_part('month', f1) AS month, - date_part('day',f1) AS day, date_part('hour', f1) AS hour, - date_part('minute', f1) AS minute, date_part('second', f1) AS second - FROM ABSTIME_TBL - WHERE isfinite(f1) and f1 <> abstime 'current' - ORDER BY abstime; - four | abstime | year | month | day | hour | minute | second -------+------------------------------+------+-------+-----+------+--------+-------- - | Sun May 11 00:59:12 1947 PDT | 1947 | 5 | 11 | 0 | 59 | 12 - | epoch | 1969 | 12 | 31 | 16 | 0 | 0 - | Sun Jan 14 03:14:21 1973 PST | 1973 | 1 | 14 | 3 | 14 | 21 - | Mon May 01 00:30:30 1995 PDT | 1995 | 5 | 1 | 0 | 30 | 30 -(4 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) + +-- 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) -- -- Conversions diff --git a/src/test/regress/expected/horology-solaris-1947.out b/src/test/regress/expected/horology-solaris-1947.out index dc8bd38e21..0097d383ba 100644 --- a/src/test/regress/expected/horology-solaris-1947.out +++ b/src/test/regress/expected/horology-solaris-1947.out @@ -694,20 +694,66 @@ SELECT '' as "54", d1 as timestamp, -- -- abstime, reltime arithmetic -- -SELECT '' AS four, f1 AS abstime, - date_part('year', f1) AS year, date_part('month', f1) AS month, - date_part('day',f1) AS day, date_part('hour', f1) AS hour, - date_part('minute', f1) AS minute, date_part('second', f1) AS second - FROM ABSTIME_TBL - WHERE isfinite(f1) and f1 <> abstime 'current' - ORDER BY abstime; - four | abstime | year | month | day | hour | minute | second -------+------------------------------+------+-------+-----+------+--------+-------- - | Sat May 10 23:59:12 1947 PDT | 1947 | 5 | 10 | 23 | 59 | 12 - | epoch | 1969 | 12 | 31 | 16 | 0 | 0 - | Sun Jan 14 03:14:21 1973 PST | 1973 | 1 | 14 | 3 | 14 | 21 - | Mon May 01 00:30:30 1995 PDT | 1995 | 5 | 1 | 0 | 30 | 30 -(4 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 +-----+------------------------------+--------------- + | Sat May 10 23:59:12 1947 PDT | @ 14 secs ago + | Sat May 10 23:59:12 1947 PDT | @ 1 min + | Sat May 10 23:59:12 1947 PDT | @ 5 hours + | Sat May 10 23:59:12 1947 PDT | @ 10 days + | Sat May 10 23:59:12 1947 PDT | @ 3 mons + | epoch | @ 14 secs ago + | epoch | @ 1 min + | epoch | @ 5 hours + | epoch | @ 10 days + | epoch | @ 3 mons +(10 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 + | Sat May 10 23: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 + | Sat May 10 23: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 + | Sat May 10 23: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 + | Sat May 10 23:59:12 1947 PDT +(3 rows) -- -- Conversions diff --git a/src/test/regress/expected/horology.out b/src/test/regress/expected/horology.out index ec84757474..7e9475d794 100644 --- a/src/test/regress/expected/horology.out +++ b/src/test/regress/expected/horology.out @@ -736,20 +736,66 @@ SELECT '' as "54", d1 as timestamp, -- -- abstime, reltime arithmetic -- -SELECT '' AS four, f1 AS abstime, - date_part('year', f1) AS year, date_part('month', f1) AS month, - date_part('day',f1) AS day, date_part('hour', f1) AS hour, - date_part('minute', f1) AS minute, date_part('second', f1) AS second - FROM ABSTIME_TBL - WHERE isfinite(f1) and f1 <> abstime 'current' - ORDER BY abstime; - four | abstime | year | month | day | hour | minute | second -------+------------------------------+------+-------+-----+------+--------+-------- - | Sat May 10 23:59:12 1947 PST | 1947 | 5 | 10 | 23 | 59 | 12 - | epoch | 1969 | 12 | 31 | 16 | 0 | 0 - | Sun Jan 14 03:14:21 1973 PST | 1973 | 1 | 14 | 3 | 14 | 21 - | Mon May 01 00:30:30 1995 PDT | 1995 | 5 | 1 | 0 | 30 | 30 -(4 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 +-----+------------------------------+--------------- + | Sat May 10 23:59:12 1947 PST | @ 14 secs ago + | Sat May 10 23:59:12 1947 PST | @ 1 min + | Sat May 10 23:59:12 1947 PST | @ 5 hours + | Sat May 10 23:59:12 1947 PST | @ 10 days + | Sat May 10 23:59:12 1947 PST | @ 3 mons + | epoch | @ 14 secs ago + | epoch | @ 1 min + | epoch | @ 5 hours + | epoch | @ 10 days + | epoch | @ 3 mons +(10 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 + | Sat May 10 23:59:12 1947 PST +(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 + | Sat May 10 23:59:12 1947 PST +(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 + | Sat May 10 23:59:12 1947 PST +(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 + | Sat May 10 23:59:12 1947 PST +(3 rows) -- -- Conversions diff --git a/src/test/regress/sql/abstime.sql b/src/test/regress/sql/abstime.sql index 019b1d6dc1..3085b87382 100644 --- a/src/test/regress/sql/abstime.sql +++ b/src/test/regress/sql/abstime.sql @@ -65,27 +65,10 @@ SELECT '' AS four, ABSTIME_TBL.* WHERE ABSTIME_TBL.f1 tinterval '["Apr 1 1950 00:00:00" "Dec 30 1999 23:00:00"]'; --- 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'; - -SELECT '' AS three, ABSTIME_TBL.* - WHERE (ABSTIME_TBL.f1 + reltime '@ 3 year ago') -- -3 years - < abstime 'Jan 14 14:00:00 1971'; - -SELECT '' AS three, ABSTIME_TBL.* - WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year') -- -(+3) years - < abstime 'Jan 14 14:00:00 1971'; - -SELECT '' AS three, ABSTIME_TBL.* - WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year ago') -- -(-3) years - < abstime 'Jan 14 14:00:00 1977'; - -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; - +SELECT '' AS four, f1 AS abstime, + date_part('year', f1) AS year, date_part('month', f1) AS month, + date_part('day',f1) AS day, date_part('hour', f1) AS hour, + date_part('minute', f1) AS minute, date_part('second', f1) AS second + FROM ABSTIME_TBL + WHERE isfinite(f1) and f1 <> abstime 'current' + ORDER BY abstime; diff --git a/src/test/regress/sql/horology.sql b/src/test/regress/sql/horology.sql index aaaf14faf3..680c259cfc 100644 --- a/src/test/regress/sql/horology.sql +++ b/src/test/regress/sql/horology.sql @@ -72,13 +72,30 @@ SELECT '' as "54", d1 as timestamp, -- abstime, reltime arithmetic -- -SELECT '' AS four, f1 AS abstime, - date_part('year', f1) AS year, date_part('month', f1) AS month, - date_part('day',f1) AS day, date_part('hour', f1) AS hour, - date_part('minute', f1) AS minute, date_part('second', f1) AS second - FROM ABSTIME_TBL - WHERE isfinite(f1) and f1 <> abstime 'current' - ORDER BY abstime; +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; + +-- 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'; + +SELECT '' AS three, ABSTIME_TBL.* + WHERE (ABSTIME_TBL.f1 + reltime '@ 3 year ago') -- -3 years + < abstime 'Jan 14 14:00:00 1971'; + +SELECT '' AS three, ABSTIME_TBL.* + WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year') -- -(+3) years + < abstime 'Jan 14 14:00:00 1971'; + +SELECT '' AS three, ABSTIME_TBL.* + WHERE (ABSTIME_TBL.f1 - reltime '@ 3 year ago') -- -(-3) years + < abstime 'Jan 14 14:00:00 1977'; -- -- Conversions diff --git a/src/test/regress/sql/run_check.tests b/src/test/regress/sql/run_check.tests index ae848c9197..ed4d33950f 100644 --- a/src/test/regress/sql/run_check.tests +++ b/src/test/regress/sql/run_check.tests @@ -31,8 +31,9 @@ parallel group2 test circle test date test time - test interval test timestamp + test interval + test abstime test reltime test tinterval test inet @@ -42,7 +43,6 @@ parallel group2 test opr_sanity endparallel -test abstime # Depends on the reltime test test geometry # Depends on point, lseg, box, path, polygon and circle test horology # Depends on interval, timestamp, reltime and abstime diff --git a/src/test/regress/sql/tests b/src/test/regress/sql/tests index 2dc72a7e57..8f383c7447 100644 --- a/src/test/regress/sql/tests +++ b/src/test/regress/sql/tests @@ -20,10 +20,10 @@ circle geometry date time -interval timestamp -reltime +interval abstime +reltime tinterval horology inet