Re: Odd transaction timestamp sequence issue

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Odd transaction timestamp sequence issue
Дата
Msg-id 20060421152729.GD29659@svana.org
обсуждение исходный текст
Ответ на Odd transaction timestamp sequence issue  (Jeff Amiel <jamiel@istreamimaging.com>)
Список pgsql-general
On Fri, Apr 21, 2006 at 09:43:55AM -0500, Jeff Amiel wrote:
> PostgreSQL 8.1.2 on i386-portbld-freebsd6.0, compiled by GCC cc (GCC)
> 3.4.4 [FreeBSD] 20050518
>
> We have triggers on each of our tables that create audit table entries
> on each insert/update/delete.
> The audit table (in addition to containing information about the change
> that was made) contains a timestamp field and a serial as the primary key.
> The timestamp is generated by calling now() inside the audit trigger, so
> should contain the timestamp of when the transaction (that yielded the
> insert/update/delete) began.

now() returns the same time throughout the transaction i.e. the
transaction start time. If you want a time independant of transaction
status, perhaps you want timeofday(). Check the docs for the specifics.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Terry Lee Tucker
Дата:
Сообщение: Re: Triggers and Transactions
Следующее
От: Jeff Amiel
Дата:
Сообщение: Re: Odd transaction timestamp sequence issue