Re: [GENERAL] CURRENT_TIMESTAMP

Поиск
Список
Период
Сортировка
От Manfred Koizar
Тема Re: [GENERAL] CURRENT_TIMESTAMP
Дата
Msg-id agb0pu83fvpta3lr1e8g46vc3sbvusi6nm@4ax.com
обсуждение исходный текст
Ответ на Re: [GENERAL] CURRENT_TIMESTAMP  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
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.

ServusManfred


В списке pgsql-sql по дате отправления:

Предыдущее
От: Manfred Koizar
Дата:
Сообщение: Re: [GENERAL] CURRENT_TIMESTAMP
Следующее
От: Manfred Koizar
Дата:
Сообщение: Re: [GENERAL] CURRENT_TIMESTAMP