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

Commit1b208eb

Browse files
committed
Add a couple more tests for interval input decoding.
Cover some cases that would have been broken by a proposed patch,but we failed to notice for lack of test coverage. I'm pushingthis separately mainly to memorialize that it *is* our historicalbehavior.Discussion:https://postgr.es/m/1344498.1648920056@sss.pgh.pa.us
1 parent14bf1e8 commit1b208eb

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,16 @@ SELECT interval '+1 -1:00:00',
826826
1 day -01:00:00 | -1 days +01:00:00 | 1 year 2 mons -3 days +04:05:06.789 | -1 years -2 mons +3 days -04:05:06.789
827827
(1 row)
828828

829+
-- cases that trigger sign-matching rules in the sql style
830+
SELECT interval '-23 hours 45 min 12.34 sec',
831+
interval '-1 day 23 hours 45 min 12.34 sec',
832+
interval '-1 year 2 months 1 day 23 hours 45 min 12.34 sec',
833+
interval '-1 year 2 months 1 day 23 hours 45 min +12.34 sec';
834+
interval | interval | interval | interval
835+
--------------+----------------------+-----------------------------+-----------------------------
836+
-22:14:47.66 | -1 days +23:45:12.34 | -10 mons +1 day 23:45:12.34 | -10 mons +1 day 23:45:12.34
837+
(1 row)
838+
829839
-- test output of couple non-standard interval values in the sql style
830840
SET IntervalStyle TO sql_standard;
831841
SELECT interval '1 day -1 hours',
@@ -837,6 +847,16 @@ SELECT interval '1 day -1 hours',
837847
+0-0 +1 -1:00:00 | +0-0 -1 +1:00:00 | +1-2 -3 +4:05:06.789 | -1-2 +3 -4:05:06.789
838848
(1 row)
839849

850+
-- cases that trigger sign-matching rules in the sql style
851+
SELECT interval '-23 hours 45 min 12.34 sec',
852+
interval '-1 day 23 hours 45 min 12.34 sec',
853+
interval '-1 year 2 months 1 day 23 hours 45 min 12.34 sec',
854+
interval '-1 year 2 months 1 day 23 hours 45 min +12.34 sec';
855+
interval | interval | interval | interval
856+
--------------+----------------+----------------------+-----------------------
857+
-23:45:12.34 | -1 23:45:12.34 | -1-2 -1 -23:45:12.34 | -0-10 +1 +23:45:12.34
858+
(1 row)
859+
840860
-- test outputting iso8601 intervals
841861
SET IntervalStyle to iso_8601;
842862
select interval '0' AS "zero",

‎src/test/regress/sql/interval.sql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,25 @@ SELECT interval '+1 -1:00:00',
258258
interval'+1-2 -3 +4:05:06.789',
259259
interval'-1-2 +3 -4:05:06.789';
260260

261+
-- cases that trigger sign-matching rules in the sql style
262+
SELECT interval'-23 hours 45 min 12.34 sec',
263+
interval'-1 day 23 hours 45 min 12.34 sec',
264+
interval'-1 year 2 months 1 day 23 hours 45 min 12.34 sec',
265+
interval'-1 year 2 months 1 day 23 hours 45 min +12.34 sec';
266+
261267
-- test output of couple non-standard interval values in the sql style
262268
SET IntervalStyle TO sql_standard;
263269
SELECT interval'1 day -1 hours',
264270
interval'-1 days +1 hours',
265271
interval'1 years 2 months -3 days 4 hours 5 minutes 6.789 seconds',
266272
- interval'1 years 2 months -3 days 4 hours 5 minutes 6.789 seconds';
267273

274+
-- cases that trigger sign-matching rules in the sql style
275+
SELECT interval'-23 hours 45 min 12.34 sec',
276+
interval'-1 day 23 hours 45 min 12.34 sec',
277+
interval'-1 year 2 months 1 day 23 hours 45 min 12.34 sec',
278+
interval'-1 year 2 months 1 day 23 hours 45 min +12.34 sec';
279+
268280
-- test outputting iso8601 intervals
269281
SET IntervalStyle to iso_8601;
270282
select interval'0'AS"zero",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp