Re: currval = currval+1

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: salah jubeh <s_jubeh(at)yahoo(dot)com>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: currval = currval+1
Date: 2011-06-01 15:52:41
Message-ID: 19511.1306943561@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

salah jubeh <s_jubeh(at)yahoo(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Geoffrey Myers 2011-06-01 17:22:40 proper regex_replace() syntax
Previous Message Merlin Moncure 2011-06-01 15:43:42 Re: currval = currval+1