Add tests for date_part of epoch near upper bound of timestamp range

This exercises a special case in the implementations of
date_part('epoch', timestamp[tz]) that was previously not tested.
This commit is contained in:
Peter Eisentraut 2021-03-30 22:05:18 +02:00
parent 4753ef37e0
commit 6131ffc43f
4 changed files with 20 additions and 0 deletions

View File

@ -1012,6 +1012,13 @@ SELECT d1 as "timestamp",
Mon Jan 01 17:32:01 2001 | 200 | 21 | 3 | 2451912 | 978370321
(65 rows)
-- value near upper bound uses special case in code
SELECT date_part('epoch', '294270-01-01 00:00:00'::timestamp);
date_part
---------------
9224097091200
(1 row)
-- TO_CHAR()
SELECT to_char(d1, 'DAY Day day DY Dy dy MONTH Month month RM MON Mon mon')
FROM TIMESTAMP_TBL;

View File

@ -1189,6 +1189,13 @@ SELECT d1 as timestamptz,
Mon Jan 01 17:32:01 2001 PST | -28800 | -8 | 0
(66 rows)
-- value near upper bound uses special case in code
SELECT date_part('epoch', '294270-01-01 00:00:00+00'::timestamptz);
date_part
---------------
9224097091200
(1 row)
-- TO_CHAR()
SELECT to_char(d1, 'DAY Day day DY Dy dy MONTH Month month RM MON Mon mon')
FROM TIMESTAMPTZ_TBL;

View File

@ -261,6 +261,9 @@ SELECT d1 as "timestamp",
date_part( 'epoch', d1) AS epoch
FROM TIMESTAMP_TBL;
-- value near upper bound uses special case in code
SELECT date_part('epoch', '294270-01-01 00:00:00'::timestamp);
-- TO_CHAR()
SELECT to_char(d1, 'DAY Day day DY Dy dy MONTH Month month RM MON Mon mon')
FROM TIMESTAMP_TBL;

View File

@ -275,6 +275,9 @@ SELECT d1 as timestamptz,
date_part( 'timezone_minute', d1) AS timezone_minute
FROM TIMESTAMPTZ_TBL;
-- value near upper bound uses special case in code
SELECT date_part('epoch', '294270-01-01 00:00:00+00'::timestamptz);
-- TO_CHAR()
SELECT to_char(d1, 'DAY Day day DY Dy dy MONTH Month month RM MON Mon mon')
FROM TIMESTAMPTZ_TBL;