Re: Execution-time-sensitive timestamp regression tests - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: Execution-time-sensitive timestamp regression tests
Date
Msg-id 874p8ou5a4.fsf@oxford.xeocode.com
Whole thread Raw
In response to Execution-time-sensitive timestamp regression tests  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Execution-time-sensitive timestamp regression tests  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
"Tom Lane" <tgl@sss.pgh.pa.us> writes:

> What I'm considering doing is putting a BEGIN/COMMIT around the whole
> sequence, which will guarantee that now() does *not* advance, thus
> eliminating the midnight gotcha.  This would mean that the expected
> output of the comparison to 'now' changes from 0 rows to 1 row.
>
> Objections, better ideas?

Alternatively we could do a pg_sleep(.1) to sleep for 100ms. It sounds like
the ideal would be something like:

insert 'now'
pg_sleep(.1)
begin
insert 'now'
select * from table -- expect 1 (not 0 or 2)
... the other tests you mention which get bitten by midnight
end

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com Ask me about EnterpriseDB's PostGIS support!


pgsql-hackers by date:

Previous
From: "Dickson S. Guedes"
Date:
Subject: TODO item: Have psql show current values for a sequence
Next
From: Teodor Sigaev
Date:
Subject: Re: [GENERAL] Fragments in tsearch2 headline