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: 4753ef3)
Add tests for date_part of epoch near upper bound of timestamp range
2021年3月30日 20:05:18 +0000 (22:05 +0200)
2021年3月30日 20:05:18 +0000 (22:05 +0200)
This exercises a special case in the implementations of
date_part('epoch', timestamp[tz]) that was previously not tested.


diff --git a/src/test/regress/expected/timestamp.out b/src/test/regress/expected/timestamp.out
index bde6d786ae678f09f5fe8ff12a92f816d6eaa1ee..fff3cf08c177a5f13b712e8fa1cd41781a498f4d 100644 (file)
--- a/src/test/regress/expected/timestamp.out
+++ b/src/test/regress/expected/timestamp.out
@@ -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;
diff --git a/src/test/regress/expected/timestamptz.out b/src/test/regress/expected/timestamptz.out
index 752333f0b0093cf99094bc64adef90d92e8851d9..ff0700807311691fe3de4b2a25b57bfba6bea6c5 100644 (file)
--- a/src/test/regress/expected/timestamptz.out
+++ b/src/test/regress/expected/timestamptz.out
@@ -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;
diff --git a/src/test/regress/sql/timestamp.sql b/src/test/regress/sql/timestamp.sql
index 458a16b5c61da0f411dda54b800fb9a1e5370763..ed03d7c2187f6991d903813c7a0e38769e44d4ad 100644 (file)
--- a/src/test/regress/sql/timestamp.sql
+++ b/src/test/regress/sql/timestamp.sql
@@ -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;
diff --git a/src/test/regress/sql/timestamptz.sql b/src/test/regress/sql/timestamptz.sql
index d21a8a4dff04183ff4b883ece58ebfe53e0d0b9f..fd1bf50a9c18fceb749ec2759dddaabab4e935a1 100644 (file)
--- a/src/test/regress/sql/timestamptz.sql
+++ b/src/test/regress/sql/timestamptz.sql
@@ -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;
This is the main PostgreSQL git repository.
RSS Atom

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