Re: Execution-time-sensitive timestamp regression tests

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Execution-time-sensitive timestamp regression tests
Date: 2008-05-25 03:34:05
Message-ID: 6232.1211686445@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gregory Stark <stark(at)enterprisedb(dot)com> writes:
> "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Gurjeet Singh 2008-05-25 04:57:09 Does 'ALTER INDEX' take exclusive lock?
Previous Message Tom Lane 2008-05-25 03:15:27 Re: \df displaying volatility