Add regression test coverage for timetz_izone().

Extend the test added by commit 97957fdba 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
This commit is contained in:
Tom Lane 2023-10-16 15:45:01 -04:00
parent 54b208f909
commit 2f04720307
2 changed files with 30 additions and 29 deletions

View File

@ -263,7 +263,7 @@ SELECT date_part('epoch', TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-
(1 row)
--
-- AT LOCAL with timetz
-- Test timetz_zone, timetz_izone, AT LOCAL
--
BEGIN;
SET LOCAL TimeZone TO 'UTC';
@ -271,36 +271,37 @@ CREATE VIEW timetz_local_view AS
SELECT f1 AS dat,
timezone(f1) AS dat_func,
f1 AT LOCAL AS dat_at_local,
f1 AT TIME ZONE current_setting('TimeZone') AS dat_at_time
f1 AT TIME ZONE current_setting('TimeZone') AS dat_at_tz,
f1 AT TIME ZONE INTERVAL '00:00' AS dat_at_int
FROM TIMETZ_TBL
ORDER BY f1;
SELECT pg_get_viewdef('timetz_local_view', true);
pg_get_viewdef
------------------------------------------------------------------------
SELECT f1 AS dat, +
timezone(f1) AS dat_func, +
(f1 AT LOCAL) AS dat_at_local, +
(f1 AT TIME ZONE current_setting('TimeZone'::text)) AS dat_at_time+
FROM timetz_tbl +
pg_get_viewdef
-----------------------------------------------------------------------
SELECT f1 AS dat, +
timezone(f1) AS dat_func, +
(f1 AT LOCAL) AS dat_at_local, +
(f1 AT TIME ZONE current_setting('TimeZone'::text)) AS dat_at_tz,+
(f1 AT TIME ZONE '@ 0'::interval) AS dat_at_int +
FROM timetz_tbl +
ORDER BY f1;
(1 row)
TABLE timetz_local_view;
dat | dat_func | dat_at_local | dat_at_time
----------------+----------------+----------------+----------------
00:01:00-07 | 07:01:00+00 | 07:01:00+00 | 07:01:00+00
01:00:00-07 | 08:00:00+00 | 08:00:00+00 | 08:00:00+00
02:03:00-07 | 09:03:00+00 | 09:03:00+00 | 09:03:00+00
08:08:00-04 | 12:08:00+00 | 12:08:00+00 | 12:08:00+00
07:07:00-08 | 15:07:00+00 | 15:07:00+00 | 15:07:00+00
11:59:00-07 | 18:59:00+00 | 18:59:00+00 | 18:59:00+00
12:00:00-07 | 19:00:00+00 | 19:00:00+00 | 19:00:00+00
12:01:00-07 | 19:01:00+00 | 19:01:00+00 | 19:01:00+00
15:36:39-04 | 19:36:39+00 | 19:36:39+00 | 19:36:39+00
15:36:39-05 | 20:36:39+00 | 20:36:39+00 | 20:36:39+00
23:59:00-07 | 06:59:00+00 | 06:59:00+00 | 06:59:00+00
23:59:59.99-07 | 06:59:59.99+00 | 06:59:59.99+00 | 06:59:59.99+00
dat | dat_func | dat_at_local | dat_at_tz | dat_at_int
----------------+----------------+----------------+----------------+----------------
00:01:00-07 | 07:01:00+00 | 07:01:00+00 | 07:01:00+00 | 07:01:00+00
01:00:00-07 | 08:00:00+00 | 08:00:00+00 | 08:00:00+00 | 08:00:00+00
02:03:00-07 | 09:03:00+00 | 09:03:00+00 | 09:03:00+00 | 09:03:00+00
08:08:00-04 | 12:08:00+00 | 12:08:00+00 | 12:08:00+00 | 12:08:00+00
07:07:00-08 | 15:07:00+00 | 15:07:00+00 | 15:07:00+00 | 15:07:00+00
11:59:00-07 | 18:59:00+00 | 18:59:00+00 | 18:59:00+00 | 18:59:00+00
12:00:00-07 | 19:00:00+00 | 19:00:00+00 | 19:00:00+00 | 19:00:00+00
12:01:00-07 | 19:01:00+00 | 19:01:00+00 | 19:01:00+00 | 19:01:00+00
15:36:39-04 | 19:36:39+00 | 19:36:39+00 | 19:36:39+00 | 19:36:39+00
15:36:39-05 | 20:36:39+00 | 20:36:39+00 | 20:36:39+00 | 20:36:39+00
23:59:00-07 | 06:59:00+00 | 06:59:00+00 | 06:59:00+00 | 06:59:00+00
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
(12 rows)
DROP VIEW timetz_local_view;
COMMIT;
ROLLBACK;

View File

@ -86,7 +86,7 @@ SELECT date_part('second', TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-
SELECT date_part('epoch', TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-04');
--
-- AT LOCAL with timetz
-- Test timetz_zone, timetz_izone, AT LOCAL
--
BEGIN;
SET LOCAL TimeZone TO 'UTC';
@ -94,10 +94,10 @@ CREATE VIEW timetz_local_view AS
SELECT f1 AS dat,
timezone(f1) AS dat_func,
f1 AT LOCAL AS dat_at_local,
f1 AT TIME ZONE current_setting('TimeZone') AS dat_at_time
f1 AT TIME ZONE current_setting('TimeZone') AS dat_at_tz,
f1 AT TIME ZONE INTERVAL '00:00' AS dat_at_int
FROM TIMETZ_TBL
ORDER BY f1;
SELECT pg_get_viewdef('timetz_local_view', true);
TABLE timetz_local_view;
DROP VIEW timetz_local_view;
COMMIT;
ROLLBACK;