"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!