Re: Odd transaction timestamp sequence issue - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Odd transaction timestamp sequence issue
Date
Msg-id 20060421152729.GD29659@svana.org
Whole thread Raw
In response to Odd transaction timestamp sequence issue  (Jeff Amiel <jamiel@istreamimaging.com>)
List 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.

Attachment

pgsql-general by date:

Previous
From: Terry Lee Tucker
Date:
Subject: Re: Triggers and Transactions
Next
From: Jeff Amiel
Date:
Subject: Re: Odd transaction timestamp sequence issue