Skip to content

Commit 2f04720

Browse files
committed
Add regression test coverage for timetz_izone().
Extend the test added by commit 97957fd so that it also covers timetz_izone(), that is the "AT TIME ZONE interval" case. This is mostly to see if xlc's apparent bug occurs there too, but more code coverage is always welcome. Discussion: https://postgr.es/m/2287835.1697464481@sss.pgh.pa.us
1 parent 54b208f commit 2f04720

File tree

2 files changed

+30
-29
lines changed

2 files changed

+30
-29
lines changed

src/test/regress/expected/timetz.out

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -263,44 +263,45 @@ SELECT date_part('epoch', TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-
263263
(1 row)
264264

265265
--
266-
-- AT LOCAL with timetz
266+
-- Test timetz_zone, timetz_izone, AT LOCAL
267267
--
268268
BEGIN;
269269
SET LOCAL TimeZone TO 'UTC';
270270
CREATE VIEW timetz_local_view AS
271271
SELECT f1 AS dat,
272272
timezone(f1) AS dat_func,
273273
f1 AT LOCAL AS dat_at_local,
274-
f1 AT TIME ZONE current_setting('TimeZone') AS dat_at_time
274+
f1 AT TIME ZONE current_setting('TimeZone') AS dat_at_tz,
275+
f1 AT TIME ZONE INTERVAL '00:00' AS dat_at_int
275276
FROM TIMETZ_TBL
276277
ORDER BY f1;
277278
SELECT pg_get_viewdef('timetz_local_view', true);
278-
pg_get_viewdef
279-
------------------------------------------------------------------------
280-
SELECT f1 AS dat, +
281-
timezone(f1) AS dat_func, +
282-
(f1 AT LOCAL) AS dat_at_local, +
283-
(f1 AT TIME ZONE current_setting('TimeZone'::text)) AS dat_at_time+
284-
FROM timetz_tbl +
279+
pg_get_viewdef
280+
-----------------------------------------------------------------------
281+
SELECT f1 AS dat, +
282+
timezone(f1) AS dat_func, +
283+
(f1 AT LOCAL) AS dat_at_local, +
284+
(f1 AT TIME ZONE current_setting('TimeZone'::text)) AS dat_at_tz,+
285+
(f1 AT TIME ZONE '@ 0'::interval) AS dat_at_int +
286+
FROM timetz_tbl +
285287
ORDER BY f1;
286288
(1 row)
287289

288290
TABLE timetz_local_view;
289-
dat | dat_func | dat_at_local | dat_at_time
290-
----------------+----------------+----------------+----------------
291-
00:01:00-07 | 07:01:00+00 | 07:01:00+00 | 07:01:00+00
292-
01:00:00-07 | 08:00:00+00 | 08:00:00+00 | 08:00:00+00
293-
02:03:00-07 | 09:03:00+00 | 09:03:00+00 | 09:03:00+00
294-
08:08:00-04 | 12:08:00+00 | 12:08:00+00 | 12:08:00+00
295-
07:07:00-08 | 15:07:00+00 | 15:07:00+00 | 15:07:00+00
296-
11:59:00-07 | 18:59:00+00 | 18:59:00+00 | 18:59:00+00
297-
12:00:00-07 | 19:00:00+00 | 19:00:00+00 | 19:00:00+00
298-
12:01:00-07 | 19:01:00+00 | 19:01:00+00 | 19:01:00+00
299-
15:36:39-04 | 19:36:39+00 | 19:36:39+00 | 19:36:39+00
300-
15:36:39-05 | 20:36:39+00 | 20:36:39+00 | 20:36:39+00
301-
23:59:00-07 | 06:59:00+00 | 06:59:00+00 | 06:59:00+00
302-
23:59:59.99-07 | 06:59:59.99+00 | 06:59:59.99+00 | 06:59:59.99+00
291+
dat | dat_func | dat_at_local | dat_at_tz | dat_at_int
292+
----------------+----------------+----------------+----------------+----------------
293+
00:01:00-07 | 07:01:00+00 | 07:01:00+00 | 07:01:00+00 | 07:01:00+00
294+
01:00:00-07 | 08:00:00+00 | 08:00:00+00 | 08:00:00+00 | 08:00:00+00
295+
02:03:00-07 | 09:03:00+00 | 09:03:00+00 | 09:03:00+00 | 09:03:00+00
296+
08:08:00-04 | 12:08:00+00 | 12:08:00+00 | 12:08:00+00 | 12:08:00+00
297+
07:07:00-08 | 15:07:00+00 | 15:07:00+00 | 15:07:00+00 | 15:07:00+00
298+
11:59:00-07 | 18:59:00+00 | 18:59:00+00 | 18:59:00+00 | 18:59:00+00
299+
12:00:00-07 | 19:00:00+00 | 19:00:00+00 | 19:00:00+00 | 19:00:00+00
300+
12:01:00-07 | 19:01:00+00 | 19:01:00+00 | 19:01:00+00 | 19:01:00+00
301+
15:36:39-04 | 19:36:39+00 | 19:36:39+00 | 19:36:39+00 | 19:36:39+00
302+
15:36:39-05 | 20:36:39+00 | 20:36:39+00 | 20:36:39+00 | 20:36:39+00
303+
23:59:00-07 | 06:59:00+00 | 06:59:00+00 | 06:59:00+00 | 06:59:00+00
304+
23:59:59.99-07 | 06:59:59.99+00 | 06:59:59.99+00 | 06:59:59.99+00 | 06:59:59.99+00
303305
(12 rows)
304306

305-
DROP VIEW timetz_local_view;
306-
COMMIT;
307+
ROLLBACK;

src/test/regress/sql/timetz.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,18 @@ SELECT date_part('second', TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-
8686
SELECT date_part('epoch', TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04');
8787

8888
--
89-
-- AT LOCAL with timetz
89+
-- Test timetz_zone, timetz_izone, AT LOCAL
9090
--
9191
BEGIN;
9292
SET LOCAL TimeZone TO 'UTC';
9393
CREATE VIEW timetz_local_view AS
9494
SELECT f1 AS dat,
9595
timezone(f1) AS dat_func,
9696
f1 AT LOCAL AS dat_at_local,
97-
f1 AT TIME ZONE current_setting('TimeZone') AS dat_at_time
97+
f1 AT TIME ZONE current_setting('TimeZone') AS dat_at_tz,
98+
f1 AT TIME ZONE INTERVAL '00:00' AS dat_at_int
9899
FROM TIMETZ_TBL
99100
ORDER BY f1;
100101
SELECT pg_get_viewdef('timetz_local_view', true);
101102
TABLE timetz_local_view;
102-
DROP VIEW timetz_local_view;
103-
COMMIT;
103+
ROLLBACK;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy