Alter the previous test for "time with time zone" implicit time zone

(which failed miserably during DST) to just compare against a time
 derived from a timestamp value.
Certainly not a direct check for a correct result, but should work
 at any time of year.
This commit is contained in:
Thomas G. Lockhart 2001-04-06 05:50:29 +00:00
parent a3ed622b63
commit 9c3bbf256b
4 changed files with 52 additions and 2 deletions

View File

@ -135,6 +135,21 @@ SELECT time with time zone '02:30-08' + interval '36:01' AS "14:31:00-08";
-- which may be either -08 or -07 depending on the time of year.
-- SELECT time with time zone '01:30' + interval '02:01' AS "03:31:00-08";
-- SELECT time with time zone '03:30' + interval '1 month 04:01' AS "07:31:00-08";
-- Try the following two tests instead, as a poor substitute
SELECT CAST(date 'today' + time with time zone '01:30'
+ interval '02:01' AS time) AS "03:31:00";
03:31:00
----------
03:31:00
(1 row)
SELECT CAST(date 'today' + time with time zone '03:30'
+ interval '1 month 04:01' AS time) AS "07:31:00";
07:31:00
----------
07:31:00
(1 row)
SELECT interval '04:30' - time with time zone '01:02' AS "+03:28";
ERROR: Unable to identify an operator '-' for types 'interval' and 'timetz'
You will have to retype this query using an explicit cast

View File

@ -135,6 +135,21 @@ SELECT time with time zone '02:30-08' + interval '36:01' AS "14:31:00-08";
-- which may be either -08 or -07 depending on the time of year.
-- SELECT time with time zone '01:30' + interval '02:01' AS "03:31:00-08";
-- SELECT time with time zone '03:30' + interval '1 month 04:01' AS "07:31:00-08";
-- Try the following two tests instead, as a poor substitute
SELECT CAST(date 'today' + time with time zone '01:30'
+ interval '02:01' AS time) AS "03:31:00";
03:31:00
----------
03:31:00
(1 row)
SELECT CAST(date 'today' + time with time zone '03:30'
+ interval '1 month 04:01' AS time) AS "07:31:00";
07:31:00
----------
07:31:00
(1 row)
SELECT interval '04:30' - time with time zone '01:02' AS "+03:28";
ERROR: Unable to identify an operator '-' for types 'interval' and 'timetz'
You will have to retype this query using an explicit cast

View File

@ -135,6 +135,21 @@ SELECT time with time zone '02:30-08' + interval '36:01' AS "14:31:00-08";
-- which may be either -08 or -07 depending on the time of year.
-- SELECT time with time zone '01:30' + interval '02:01' AS "03:31:00-08";
-- SELECT time with time zone '03:30' + interval '1 month 04:01' AS "07:31:00-08";
-- Try the following two tests instead, as a poor substitute
SELECT CAST(date 'today' + time with time zone '01:30'
+ interval '02:01' AS time) AS "03:31:00";
03:31:00
----------
03:31:00
(1 row)
SELECT CAST(date 'today' + time with time zone '03:30'
+ interval '1 month 04:01' AS time) AS "07:31:00";
07:31:00
----------
07:31:00
(1 row)
SELECT interval '04:30' - time with time zone '01:02' AS "+03:28";
ERROR: Unable to identify an operator '-' for types 'interval' and 'timetz'
You will have to retype this query using an explicit cast

View File

@ -60,10 +60,15 @@ SELECT time with time zone '02:30-08' + interval '36:01' AS "14:31:00-08";
-- These two tests cannot be used because they default to current timezone,
-- which may be either -08 or -07 depending on the time of year.
-- SELECT time with time zone '01:30' + interval '02:01' AS "03:31:00-08";
-- SELECT time with time zone '03:30' + interval '1 month 04:01' AS "07:31:00-08";
-- Try the following two tests instead, as a poor substitute
SELECT CAST(date 'today' + time with time zone '01:30'
+ interval '02:01' AS time) AS "03:31:00";
SELECT CAST(date 'today' + time with time zone '03:30'
+ interval '1 month 04:01' AS time) AS "07:31:00";
SELECT interval '04:30' - time with time zone '01:02' AS "+03:28";