Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdc159b9

Browse files
committed
Back-patch test cases for timetz_zone/timetz_izone.
Per code coverage reports, we had zero regression test coverageof these functions. That came back to bite us, as apparentlythat's allowed us to miss discovering misbehavior of this codewith AIX's xlc compiler. Install relevant portions of thetest cases added in97957fd,2f04720,19fa977.(Assuming the expected outcome that the xlc problem does appearin back branches, a code fix will follow.)Discussion:https://postgr.es/m/CA+hUKGK=DOC+hE-62FKfZy=Ybt5uLkrg3zCZD-jFykM-iPn8yw@mail.gmail.com
1 parent54fc9dc commitdc159b9

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

‎src/test/regress/expected/timetz.out

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,63 @@ SELECT date_part('epoch', TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-
231231
63025.575401
232232
(1 row)
233233

234+
--
235+
-- Test timetz_zone, timetz_izone
236+
--
237+
BEGIN;
238+
SET LOCAL TimeZone TO 'UTC';
239+
CREATE VIEW timetz_local_view AS
240+
SELECT f1 AS dat,
241+
f1 AT TIME ZONE current_setting('TimeZone') AS dat_at_tz,
242+
f1 AT TIME ZONE INTERVAL '00:00' AS dat_at_int
243+
FROM TIMETZ_TBL
244+
ORDER BY f1;
245+
SELECT pg_get_viewdef('timetz_local_view', true);
246+
pg_get_viewdef
247+
----------------------------------------------------------------------------------
248+
SELECT timetz_tbl.f1 AS dat, +
249+
(timetz_tbl.f1 AT TIME ZONE current_setting('TimeZone'::text)) AS dat_at_tz,+
250+
(timetz_tbl.f1 AT TIME ZONE '@ 0'::interval) AS dat_at_int +
251+
FROM timetz_tbl +
252+
ORDER BY timetz_tbl.f1;
253+
(1 row)
254+
255+
TABLE timetz_local_view;
256+
dat | dat_at_tz | dat_at_int
257+
----------------+----------------+----------------
258+
00:01:00-07 | 07:01:00+00 | 07:01:00+00
259+
01:00:00-07 | 08:00:00+00 | 08:00:00+00
260+
02:03:00-07 | 09:03:00+00 | 09:03:00+00
261+
08:08:00-04 | 12:08:00+00 | 12:08:00+00
262+
07:07:00-08 | 15:07:00+00 | 15:07:00+00
263+
11:59:00-07 | 18:59:00+00 | 18:59:00+00
264+
12:00:00-07 | 19:00:00+00 | 19:00:00+00
265+
12:01:00-07 | 19:01:00+00 | 19:01:00+00
266+
15:36:39-04 | 19:36:39+00 | 19:36:39+00
267+
15:36:39-05 | 20:36:39+00 | 20:36:39+00
268+
23:59:00-07 | 06:59:00+00 | 06:59:00+00
269+
23:59:59.99-07 | 06:59:59.99+00 | 06:59:59.99+00
270+
(12 rows)
271+
272+
SELECT f1 AS dat,
273+
f1 AT TIME ZONE 'UTC+10' AS dat_at_tz,
274+
f1 AT TIME ZONE INTERVAL '-10:00' AS dat_at_int
275+
FROM TIMETZ_TBL
276+
ORDER BY f1;
277+
dat | dat_at_tz | dat_at_int
278+
----------------+----------------+----------------
279+
00:01:00-07 | 21:01:00-10 | 21:01:00-10
280+
01:00:00-07 | 22:00:00-10 | 22:00:00-10
281+
02:03:00-07 | 23:03:00-10 | 23:03:00-10
282+
08:08:00-04 | 02:08:00-10 | 02:08:00-10
283+
07:07:00-08 | 05:07:00-10 | 05:07:00-10
284+
11:59:00-07 | 08:59:00-10 | 08:59:00-10
285+
12:00:00-07 | 09:00:00-10 | 09:00:00-10
286+
12:01:00-07 | 09:01:00-10 | 09:01:00-10
287+
15:36:39-04 | 09:36:39-10 | 09:36:39-10
288+
15:36:39-05 | 10:36:39-10 | 10:36:39-10
289+
23:59:00-07 | 20:59:00-10 | 20:59:00-10
290+
23:59:59.99-07 | 20:59:59.99-10 | 20:59:59.99-10
291+
(12 rows)
292+
293+
ROLLBACK;

‎src/test/regress/sql/timetz.sql

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,23 @@ SELECT date_part('microsecond', TIME WITH TIME ZONE '2020-05-26 13:30:25.575401-
7777
SELECT date_part('millisecond',TIME WITH TIME ZONE'2020-05-26 13:30:25.575401-04');
7878
SELECT date_part('second',TIME WITH TIME ZONE'2020-05-26 13:30:25.575401-04');
7979
SELECT date_part('epoch',TIME WITH TIME ZONE'2020-05-26 13:30:25.575401-04');
80+
81+
--
82+
-- Test timetz_zone, timetz_izone
83+
--
84+
BEGIN;
85+
SET LOCAL TimeZone TO'UTC';
86+
CREATEVIEWtimetz_local_viewAS
87+
SELECT f1AS dat,
88+
f1 ATTIME ZONE current_setting('TimeZone')AS dat_at_tz,
89+
f1 ATTIME ZONE INTERVAL'00:00'AS dat_at_int
90+
FROM TIMETZ_TBL
91+
ORDER BY f1;
92+
SELECT pg_get_viewdef('timetz_local_view', true);
93+
TABLE timetz_local_view;
94+
SELECT f1AS dat,
95+
f1 ATTIME ZONE'UTC+10'AS dat_at_tz,
96+
f1 ATTIME ZONE INTERVAL'-10:00'AS dat_at_int
97+
FROM TIMETZ_TBL
98+
ORDER BY f1;
99+
ROLLBACK;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp