mirror of
https://github.com/postgres/postgres.git
synced 2025-05-05 09:19:17 +03:00
Add upper boundary tests for timestamp and timestamptz types
The existing regression tests only tested the lower boundary of the range supported by the timestamp and timestamptz types because "The upper boundary differs between integer and float timestamps, so no check". Since this is obsolete, add similar tests for the upper boundary.
This commit is contained in:
parent
f64ea6dc5c
commit
bc9f1afdeb
@ -234,7 +234,7 @@ SELECT d1 FROM TIMESTAMP_TBL;
|
||||
Mon Jan 01 17:32:01 2001
|
||||
(65 rows)
|
||||
|
||||
-- Check behavior at the lower boundary of the timestamp range
|
||||
-- Check behavior at the boundaries of the timestamp range
|
||||
SELECT '4714-11-24 00:00:00 BC'::timestamp;
|
||||
timestamp
|
||||
-----------------------------
|
||||
@ -245,7 +245,16 @@ SELECT '4714-11-23 23:59:59 BC'::timestamp; -- out of range
|
||||
ERROR: timestamp out of range: "4714-11-23 23:59:59 BC"
|
||||
LINE 1: SELECT '4714-11-23 23:59:59 BC'::timestamp;
|
||||
^
|
||||
-- The upper boundary differs between integer and float timestamps, so no check
|
||||
SELECT '294276-12-31 23:59:59'::timestamp;
|
||||
timestamp
|
||||
----------------------------
|
||||
Sun Dec 31 23:59:59 294276
|
||||
(1 row)
|
||||
|
||||
SELECT '294277-01-01 00:00:00'::timestamp; -- out of range
|
||||
ERROR: timestamp out of range: "294277-01-01 00:00:00"
|
||||
LINE 1: SELECT '294277-01-01 00:00:00'::timestamp;
|
||||
^
|
||||
-- Demonstrate functions and operators
|
||||
SELECT d1 FROM TIMESTAMP_TBL
|
||||
WHERE d1 > timestamp without time zone '1997-01-02';
|
||||
|
@ -318,7 +318,7 @@ SELECT d1 FROM TIMESTAMPTZ_TBL;
|
||||
Mon Jan 01 17:32:01 2001 PST
|
||||
(66 rows)
|
||||
|
||||
-- Check behavior at the lower boundary of the timestamp range
|
||||
-- Check behavior at the boundaries of the timestamp range
|
||||
SELECT '4714-11-24 00:00:00+00 BC'::timestamptz;
|
||||
timestamptz
|
||||
---------------------------------
|
||||
@ -341,7 +341,26 @@ SELECT '4714-11-23 23:59:59+00 BC'::timestamptz; -- out of range
|
||||
ERROR: timestamp out of range: "4714-11-23 23:59:59+00 BC"
|
||||
LINE 1: SELECT '4714-11-23 23:59:59+00 BC'::timestamptz;
|
||||
^
|
||||
-- The upper boundary differs between integer and float timestamps, so no check
|
||||
SELECT '294276-12-31 23:59:59+00'::timestamptz;
|
||||
timestamptz
|
||||
--------------------------------
|
||||
Sun Dec 31 15:59:59 294276 PST
|
||||
(1 row)
|
||||
|
||||
SELECT '294276-12-31 15:59:59-08'::timestamptz;
|
||||
timestamptz
|
||||
--------------------------------
|
||||
Sun Dec 31 15:59:59 294276 PST
|
||||
(1 row)
|
||||
|
||||
SELECT '294277-01-01 00:00:00+00'::timestamptz; -- out of range
|
||||
ERROR: timestamp out of range: "294277-01-01 00:00:00+00"
|
||||
LINE 1: SELECT '294277-01-01 00:00:00+00'::timestamptz;
|
||||
^
|
||||
SELECT '294277-12-31 16:00:00-08'::timestamptz; -- out of range
|
||||
ERROR: timestamp out of range: "294277-12-31 16:00:00-08"
|
||||
LINE 1: SELECT '294277-12-31 16:00:00-08'::timestamptz;
|
||||
^
|
||||
-- Demonstrate functions and operators
|
||||
SELECT d1 FROM TIMESTAMPTZ_TBL
|
||||
WHERE d1 > timestamp with time zone '1997-01-02';
|
||||
|
@ -137,10 +137,11 @@ INSERT INTO TIMESTAMP_TBL VALUES ('Feb 16 17:32:01 5097 BC');
|
||||
|
||||
SELECT d1 FROM TIMESTAMP_TBL;
|
||||
|
||||
-- Check behavior at the lower boundary of the timestamp range
|
||||
-- Check behavior at the boundaries of the timestamp range
|
||||
SELECT '4714-11-24 00:00:00 BC'::timestamp;
|
||||
SELECT '4714-11-23 23:59:59 BC'::timestamp; -- out of range
|
||||
-- The upper boundary differs between integer and float timestamps, so no check
|
||||
SELECT '294276-12-31 23:59:59'::timestamp;
|
||||
SELECT '294277-01-01 00:00:00'::timestamp; -- out of range
|
||||
|
||||
-- Demonstrate functions and operators
|
||||
SELECT d1 FROM TIMESTAMP_TBL
|
||||
|
@ -158,12 +158,15 @@ SELECT 'Wed Jul 11 10:51:14 PST+03:00 2001'::timestamptz;
|
||||
|
||||
SELECT d1 FROM TIMESTAMPTZ_TBL;
|
||||
|
||||
-- Check behavior at the lower boundary of the timestamp range
|
||||
-- Check behavior at the boundaries of the timestamp range
|
||||
SELECT '4714-11-24 00:00:00+00 BC'::timestamptz;
|
||||
SELECT '4714-11-23 16:00:00-08 BC'::timestamptz;
|
||||
SELECT 'Sun Nov 23 16:00:00 4714 PST BC'::timestamptz;
|
||||
SELECT '4714-11-23 23:59:59+00 BC'::timestamptz; -- out of range
|
||||
-- The upper boundary differs between integer and float timestamps, so no check
|
||||
SELECT '294276-12-31 23:59:59+00'::timestamptz;
|
||||
SELECT '294276-12-31 15:59:59-08'::timestamptz;
|
||||
SELECT '294277-01-01 00:00:00+00'::timestamptz; -- out of range
|
||||
SELECT '294277-12-31 16:00:00-08'::timestamptz; -- out of range
|
||||
|
||||
-- Demonstrate functions and operators
|
||||
SELECT d1 FROM TIMESTAMPTZ_TBL
|
||||
|
Loading…
x
Reference in New Issue
Block a user