pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Manfred Koizar <mkoi-pg@aon.at>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: josh@agliodbs.com, Aaron Held <aaron@MetroNY.com>
Cc: Roberto Mello <rmello@cc.usu.edu>
Cc: Neil Conway <neilc@samurai.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: [GENERAL] CURRENT_TIMESTAMP
Date: Tue, 24 Sep 2002 11:37:30 +0200
Message-ID: <agb0pu83fvpta3lr1e8g46vc3sbvusi6nm@4ax.com> (raw)
In-Reply-To: <4619.1032814548@sss.pgh.pa.us>
References: <200209232041.g8NKfix19001@candle.pha.pa.us>
	<4619.1032814548@sss.pgh.pa.us>

On Mon, 23 Sep 2002 16:55:48 -0400, Tom Lane <tgl@sss.pgh.pa.us>
wrote:
>Bruce Momjian <pgman@candle.pha.pa.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



view thread (61+ messages)  latest in thread

Message-ID: <agb0pu83fvpta3lr1e8g46vc3sbvusi6nm@4ax.com>
Permalink:  ../agb0pu83fvpta3lr1e8g46vc3sbvusi6nm@4ax.com/
Also on:    postgresql.org/message-id/agb0pu83fvpta3lr1e8g46vc3sbvusi6nm@4ax.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mkoi-pg@aon.at, tgl@sss.pgh.pa.us, pgman@candle.pha.pa.us, aaron@MetroNY.com, rmello@cc.usu.edu, neilc@samurai.com
  Subject: Re: [GENERAL] CURRENT_TIMESTAMP
  In-Reply-To: <agb0pu83fvpta3lr1e8g46vc3sbvusi6nm@4ax.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox