Skip to content

Commit 9c3bbf2

Browse files
author
Thomas G. Lockhart
committed
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.
1 parent a3ed622 commit 9c3bbf2

File tree

4 files changed

+52
-2
lines changed

4 files changed

+52
-2
lines changed

src/test/regress/expected/horology-no-DST-before-1970.out

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,21 @@ SELECT time with time zone '02:30-08' + interval '36:01' AS "14:31:00-08";
135135
-- which may be either -08 or -07 depending on the time of year.
136136
-- SELECT time with time zone '01:30' + interval '02:01' AS "03:31:00-08";
137137
-- SELECT time with time zone '03:30' + interval '1 month 04:01' AS "07:31:00-08";
138+
-- Try the following two tests instead, as a poor substitute
139+
SELECT CAST(date 'today' + time with time zone '01:30'
140+
+ interval '02:01' AS time) AS "03:31:00";
141+
03:31:00
142+
----------
143+
03:31:00
144+
(1 row)
145+
146+
SELECT CAST(date 'today' + time with time zone '03:30'
147+
+ interval '1 month 04:01' AS time) AS "07:31:00";
148+
07:31:00
149+
----------
150+
07:31:00
151+
(1 row)
152+
138153
SELECT interval '04:30' - time with time zone '01:02' AS "+03:28";
139154
ERROR: Unable to identify an operator '-' for types 'interval' and 'timetz'
140155
You will have to retype this query using an explicit cast

src/test/regress/expected/horology-solaris-1947.out

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,21 @@ SELECT time with time zone '02:30-08' + interval '36:01' AS "14:31:00-08";
135135
-- which may be either -08 or -07 depending on the time of year.
136136
-- SELECT time with time zone '01:30' + interval '02:01' AS "03:31:00-08";
137137
-- SELECT time with time zone '03:30' + interval '1 month 04:01' AS "07:31:00-08";
138+
-- Try the following two tests instead, as a poor substitute
139+
SELECT CAST(date 'today' + time with time zone '01:30'
140+
+ interval '02:01' AS time) AS "03:31:00";
141+
03:31:00
142+
----------
143+
03:31:00
144+
(1 row)
145+
146+
SELECT CAST(date 'today' + time with time zone '03:30'
147+
+ interval '1 month 04:01' AS time) AS "07:31:00";
148+
07:31:00
149+
----------
150+
07:31:00
151+
(1 row)
152+
138153
SELECT interval '04:30' - time with time zone '01:02' AS "+03:28";
139154
ERROR: Unable to identify an operator '-' for types 'interval' and 'timetz'
140155
You will have to retype this query using an explicit cast

src/test/regress/expected/horology.out

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,21 @@ SELECT time with time zone '02:30-08' + interval '36:01' AS "14:31:00-08";
135135
-- which may be either -08 or -07 depending on the time of year.
136136
-- SELECT time with time zone '01:30' + interval '02:01' AS "03:31:00-08";
137137
-- SELECT time with time zone '03:30' + interval '1 month 04:01' AS "07:31:00-08";
138+
-- Try the following two tests instead, as a poor substitute
139+
SELECT CAST(date 'today' + time with time zone '01:30'
140+
+ interval '02:01' AS time) AS "03:31:00";
141+
03:31:00
142+
----------
143+
03:31:00
144+
(1 row)
145+
146+
SELECT CAST(date 'today' + time with time zone '03:30'
147+
+ interval '1 month 04:01' AS time) AS "07:31:00";
148+
07:31:00
149+
----------
150+
07:31:00
151+
(1 row)
152+
138153
SELECT interval '04:30' - time with time zone '01:02' AS "+03:28";
139154
ERROR: Unable to identify an operator '-' for types 'interval' and 'timetz'
140155
You will have to retype this query using an explicit cast

src/test/regress/sql/horology.sql

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,15 @@ SELECT time with time zone '02:30-08' + interval '36:01' AS "14:31:00-08";
6060

6161
-- These two tests cannot be used because they default to current timezone,
6262
-- which may be either -08 or -07 depending on the time of year.
63-
6463
-- SELECT time with time zone '01:30' + interval '02:01' AS "03:31:00-08";
65-
6664
-- SELECT time with time zone '03:30' + interval '1 month 04:01' AS "07:31:00-08";
65+
-- Try the following two tests instead, as a poor substitute
66+
67+
SELECT CAST(date 'today' + time with time zone '01:30'
68+
+ interval '02:01' AS time) AS "03:31:00";
69+
70+
SELECT CAST(date 'today' + time with time zone '03:30'
71+
+ interval '1 month 04:01' AS time) AS "07:31:00";
6772

6873
SELECT interval '04:30' - time with time zone '01:02' AS "+03:28";
6974

0 commit comments

Comments
 (0)