git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f64ea6d)
Add upper boundary tests for timestamp and timestamptz types
2021年3月30日 06:46:34 +0000 (08:46 +0200)
2021年3月30日 06:46:34 +0000 (08:46 +0200)
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.


diff --git a/src/test/regress/expected/timestamp.out b/src/test/regress/expected/timestamp.out
index 233ac50d7e6771b9b391cdae5b67710271f86e9c..bde6d786ae678f09f5fe8ff12a92f816d6eaa1ee 100644 (file)
--- a/src/test/regress/expected/timestamp.out
+++ b/src/test/regress/expected/timestamp.out
@@ -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日';
diff --git a/src/test/regress/expected/timestamptz.out b/src/test/regress/expected/timestamptz.out
index abd8a645a0a7a80e7fdb46b565677c2246c9eccc..752333f0b0093cf99094bc64adef90d92e8851d9 100644 (file)
--- a/src/test/regress/expected/timestamptz.out
+++ b/src/test/regress/expected/timestamptz.out
@@ -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日';
diff --git a/src/test/regress/sql/timestamp.sql b/src/test/regress/sql/timestamp.sql
index 78116a38e837f8d59ec150931ca092d7cec2346d..458a16b5c61da0f411dda54b800fb9a1e5370763 100644 (file)
--- a/src/test/regress/sql/timestamp.sql
+++ b/src/test/regress/sql/timestamp.sql
@@ -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
diff --git a/src/test/regress/sql/timestamptz.sql b/src/test/regress/sql/timestamptz.sql
index 7ad6edcd61c2ea7a8c94a78b496c78c308612de9..d21a8a4dff04183ff4b883ece58ebfe53e0d0b9f 100644 (file)
--- a/src/test/regress/sql/timestamptz.sql
+++ b/src/test/regress/sql/timestamptz.sql
@@ -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
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /