Re: Odd transaction timestamp sequence issue

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Jeff Amiel <jamiel(at)istreamimaging(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Odd transaction timestamp sequence issue
Date: 2006-04-21 15:27:29
Message-ID: 20060421152729.GD29659@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vivek Khera 2006-04-21 15:34:00 Re: Setup for large database
Previous Message Jeff Amiel 2006-04-21 15:19:30 Re: Odd transaction timestamp sequence issue