Re: Execution-time-sensitive timestamp regression tests

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: Execution-time-sensitive timestamp regression tests
Date: 2008-05-23 20:36:19
Message-ID: 874p8ou5a4.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)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!

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2008-05-23 20:38:28 Re: [HACKERS] WITH RECURSIVE patch V0.1
Previous Message Magnus Hagander 2008-05-23 20:29:22 Re: Execution-time-sensitive timestamp regression tests