Re: Anomalies with the now() function

From: Andreas Seltenreich <andreas+pg(at)gate450(dot)dyndns(dot)org>
To: Byrne Kevin-kbyrne01 <kbyrne01(at)motorola(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Anomalies with the now() function
Date: 2005-11-19 02:30:19
Message-ID: 87y83lmksk.fsf@gate450.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Byrne Kevin-kbyrne writes:

> I have a trigger set up on a db - when a row is added to a certain
> table (say Table A) in my db the trigger calls a function and then the
> function enters another line in a related table (say Table B). Here's
> the problem, the first addition to Table A may show the time of the
> addition as, for example 19:01:53. This is correct. The second
> addition, triggered by the first additon, shows a time of say
> 19:01:10! The addition of the row to Table B uses the now() function
> to determine the time the new row is added to the table. This should
> in theory match the time (to within a few milliseconds at least) the
> first row was added, since the trigger is immediate. However, I am
> seeing major time differences? How reliable is now() - has anyone seen
> anything similar ?

Very reliable: now() always returns the timestamp of the transaction
start. Maybe your timestamp on Table A is created by other means,
possibly timeofday()?

--

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Scott Ribe 2005-11-19 02:35:58 Re: Sun supporting PostgreSQL
Previous Message Otto Blomqvist 2005-11-19 00:51:18 Postgres Disconnection problems