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

From Tom Lane
Subject Re: Execution-time-sensitive timestamp regression tests
Date
Msg-id 6232.1211686445@sss.pgh.pa.us
Whole thread Raw
In response to Re: Execution-time-sensitive timestamp regression tests  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-hackers
Gregory Stark <stark@enterprisedb.com> writes:
> "Tom Lane" <tgl@sss.pgh.pa.us> writes:
>> 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

Roger, will do.

There actually still is a small risk in the sequence: if the BEGIN
block starts *exactly* at midnight, to within the resolution of
gettimeofday(), then 'now' and 'today' will yield the same value so
the expected row counts will not be matched.  This seems like an
acceptably small probability to me.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: \df displaying volatility
Next
From: "Gurjeet Singh"
Date:
Subject: Does 'ALTER INDEX' take exclusive lock?