Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2023-10-16 19:45:01 +0000
committerTom Lane2023-10-16 19:45:01 +0000
commit2f047203074c643ae458dcf51bbb8ae45dd7e13c (patch)
treee1d57844088e75525478d737f9c08259bbc1098d
parent54b208f90963cb8b48b9794a5392b2fae4b40a98 (diff)
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
-rw-r--r--src/test/regress/expected/timetz.out51
-rw-r--r--src/test/regress/sql/timetz.sql8
2 files changed, 30 insertions, 29 deletions
diff --git a/src/test/regress/expected/timetz.out b/src/test/regress/expected/timetz.out
index 7293c3bbb7b..3f8e005ce70 100644
--- a/src/test/regress/expected/timetz.out
+++ b/src/test/regress/expected/timetz.out
@@ -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;
diff --git a/src/test/regress/sql/timetz.sql b/src/test/regress/sql/timetz.sql
index 846006640e3..33f7f8aafb4 100644
--- a/src/test/regress/sql/timetz.sql
+++ b/src/test/regress/sql/timetz.sql
@@ -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;