Re: Execution-time-sensitive timestamp regression tests

Поиск
Список
Период
Сортировка
От Gregory Stark
Тема Re: Execution-time-sensitive timestamp regression tests
Дата
Msg-id 874p8ou5a4.fsf@oxford.xeocode.com
обсуждение исходный текст
Ответ на Execution-time-sensitive timestamp regression tests  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Execution-time-sensitive timestamp regression tests  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: "Dickson S. Guedes"
Дата:
Сообщение: TODO item: Have psql show current values for a sequence
Следующее
От: Teodor Sigaev
Дата:
Сообщение: Re: [GENERAL] Fragments in tsearch2 headline