Re: [GENERAL] CURRENT_TIMESTAMP

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, josh(at)agliodbs(dot)com, Aaron Held <aaron(at)MetroNY(dot)com>, Roberto Mello <rmello(at)cc(dot)usu(dot)edu>, Neil Conway <neilc(at)samurai(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: [GENERAL] CURRENT_TIMESTAMP
Date: 2002-09-24 09:37:30
Message-ID: agb0pu83fvpta3lr1e8g46vc3sbvusi6nm@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-sql

On Mon, 23 Sep 2002 16:55:48 -0400, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
wrote:
>Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
>Here's an example:
>
>CREATE RULE foo AS ON INSERT TO mytable DO
>( INSERT INTO log1 VALUES (... , now(), ...);
> INSERT INTO log2 VALUES (... , now(), ...) );
>
>I think it's important that these commands store the same timestamp in
>both log tables (not to mention that any now() being stored into mytable
>itself generate that same timestamp).

I agree. SQL99 mentions this requirement for triggers and I think we
can apply it to rules as well.

Here is another example:

BEGIN;
INSERT INTO foo VALUES (..., CURRENT_TIMESTAMP, ...);
-- wait a few seconds
INSERT INTO foo VALUES (..., CURRENT_TIMESTAMP, ...);
COMMIT;

Please don't ask me, why I would want that, but the standard demands
the timestamps to be different.

>After all, it's only a minor implementation
>detail that you chose to fire these logging operations via a rule and
>not by client-side logic.

No, it's fundamentally different whether you do something in one
SQL-statment or per a sequence of statements.

Servus
Manfred

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Manfred Koizar 2002-09-24 09:44:42 Re: [GENERAL] CURRENT_TIMESTAMP
Previous Message Manfred Koizar 2002-09-24 09:16:20 Re: [GENERAL] CURRENT_TIMESTAMP

Browse pgsql-hackers by date

  From Date Subject
Next Message Manfred Koizar 2002-09-24 09:44:42 Re: [GENERAL] CURRENT_TIMESTAMP
Previous Message Manfred Koizar 2002-09-24 09:16:20 Re: [GENERAL] CURRENT_TIMESTAMP

Browse pgsql-sql by date

  From Date Subject
Next Message Manfred Koizar 2002-09-24 09:44:42 Re: [GENERAL] CURRENT_TIMESTAMP
Previous Message Manfred Koizar 2002-09-24 09:16:20 Re: [GENERAL] CURRENT_TIMESTAMP