Re: currval = currval+1 - Mailing list pgsql-general

From Tom Lane
Subject Re: currval = currval+1
Date
Msg-id 19511.1306943561@sss.pgh.pa.us
Whole thread Raw
In response to Re: currval = currval+1  (salah jubeh <s_jubeh@yahoo.com>)
List pgsql-general
salah jubeh <s_jubeh@yahoo.com> writes:
> I have some rules on the table and I have dropped them and everything went fine.

Rules are macros, and have the usual issues with multiple evaluations of
multiply-referenced arguments.

> CREATE OR REPLACE RULE status_change_ins AS
>     ON INSERT TO account  DO  INSERT INTO account_status_change_log (account_id,
> account_status_id, status_change_date)
>   VALUES (new.account_id, new.account_status_id, now());

You'd be far better off doing that with a trigger.

            regards, tom lane

pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: currval = currval+1
Next
From: Steve Crawford
Date:
Subject: Re: Some clarification about TIMESTAMP