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

Commitbd4c76a

Browse files
committed
Fix interval test, which was broken for floating-point timestamps.
Commit4318dae introduced a test thatcouldn't be made consistent between integer and floating-pointtimestamps.It was designed to test the longest possible interval output length,so removing four zeros from the number of hours, as this patch does,is not ideal. But the test still has some utility for its originalpurpose, and there aren't a lot of other good options.Noah Misch suggested a different approach where we test that theoutput either matches what we expect from integer timestamps or whatwe expect from floating-point timestamps. That seemed to obscure anotherwise simple test, however.Reviewed by Tom Lane and Noah Misch.
1 parent99058cf commitbd4c76a

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,13 @@ select '4 millenniums 5 centuries 4 decades 1 year 4 months 4 days 17 minutes 31
307307
(1 row)
308308

309309
-- test long interval output
310-
select '100000000y 10mon -1000000000d -1000000000h -10min -10.000001s ago'::interval;
311-
interval
312-
-------------------------------------------------------------------------------------------
313-
@ 100000000 years 10 mons -1000000000 days -1000000000 hours -10 mins -10.000001 secs ago
310+
-- Note: the actual maximum length of the interval output is longer,
311+
-- but we need the test to work for both integer and floating-point
312+
-- timestamps.
313+
select '100000000y 10mon -1000000000d -100000h -10min -10.000001s ago'::interval;
314+
interval
315+
---------------------------------------------------------------------------------------
316+
@ 100000000 years 10 mons -1000000000 days -100000 hours -10 mins -10.000001 secs ago
314317
(1 row)
315318

316319
-- test justify_hours() and justify_days()

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ select avg(f1) from interval_tbl;
109109
select'4 millenniums 5 centuries 4 decades 1 year 4 months 4 days 17 minutes 31 seconds'::interval;
110110

111111
-- test long interval output
112-
select'100000000y 10mon -1000000000d -1000000000h -10min -10.000001s ago'::interval;
112+
-- Note: the actual maximum length of the interval output is longer,
113+
-- but we need the test to work for both integer and floating-point
114+
-- timestamps.
115+
select'100000000y 10mon -1000000000d -100000h -10min -10.000001s ago'::interval;
113116

114117
-- test justify_hours() and justify_days()
115118

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp