postgres.git / summary / log / commit / refs

commit    bd4c76a3c5d141462e149a130d0cbeca36e11e88
Author:   Jeff Davis <jdavis@postgresql.org>
Date:     Wed May 07 02:35:24 2014 +0000

    Fix interval test, which was broken for floating-point timestamps.
    
    Commit 4318daecc959886d001a6e79c6ea853e8b1dfb4b introduced a test that
    couldn't be made consistent between integer and floating-point
    timestamps.
    
    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 original
    purpose, and there aren't a lot of other good options.
    
    Noah Misch suggested a different approach where we test that the
    output either matches what we expect from integer timestamps or what
    we expect from floating-point timestamps. That seemed to obscure an
    otherwise simple test, however.
    
    Reviewed by Tom Lane and Noah Misch.


src/test/regress/expected/interval.out | 11 +++++++---- src/test/regress/sql/interval.sql | 5 ++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/test/regress/expected/interval.out b/src/test/regress/expected/interval.out index 5406f97512f..bf2325a725b 100644 --- a/src/test/regress/expected/interval.out +++ b/src/test/regress/expected/interval.out @@ -307,10 +307,13 @@ select '4 millenniums 5 centuries 4 decades 1 year 4 months 4 days 17 minutes 31 (1 row) -- test long interval output -select '100000000y 10mon -1000000000d -1000000000h -10min -10.000001s ago'::interval; - interval -------------------------------------------------------------------------------------------- - @ 100000000 years 10 mons -1000000000 days -1000000000 hours -10 mins -10.000001 secs ago +-- Note: the actual maximum length of the interval output is longer, +-- but we need the test to work for both integer and floating-point +-- timestamps. +select '100000000y 10mon -1000000000d -100000h -10min -10.000001s ago'::interval; + interval +--------------------------------------------------------------------------------------- + @ 100000000 years 10 mons -1000000000 days -100000 hours -10 mins -10.000001 secs ago (1 row) -- test justify_hours() and justify_days() diff --git a/src/test/regress/sql/interval.sql b/src/test/regress/sql/interval.sql index 5bbd2696a4a..c9541271860 100644 --- a/src/test/regress/sql/interval.sql +++ b/src/test/regress/sql/interval.sql @@ -109,7 +109,10 @@ select avg(f1) from interval_tbl; select '4 millenniums 5 centuries 4 decades 1 year 4 months 4 days 17 minutes 31 seconds'::interval; -- test long interval output -select '100000000y 10mon -1000000000d -1000000000h -10min -10.000001s ago'::interval; +-- Note: the actual maximum length of the interval output is longer, +-- but we need the test to work for both integer and floating-point +-- timestamps. +select '100000000y 10mon -1000000000d -100000h -10min -10.000001s ago'::interval; -- test justify_hours() and justify_days() [parent: 99058cfc634a]