Re: BUG #3929: RULE causes unintended update of SEQUENCE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Arjan Tuinhout" <at(at)tuko(dot)nl>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3929: RULE causes unintended update of SEQUENCE
Date: 2008-02-05 17:00:26
Message-ID: 23074.1202230826@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Arjan Tuinhout" <at(at)tuko(dot)nl> writes:
> -- However the intended code does not work: appearantly the SEQUENCE is
> update by calling the RULE; proofed by the workaround.

This is the expected behavior with a rule --- it's a macro, so multiple
references to the same input value risk multiple evaluations.

> -- Please help. Thanx. Arjan.

Use a trigger instead when your intent is to copy data from the
inserted/updated row to someplace else.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Magnus Hagander 2008-02-05 17:56:39 Re: [BUGS] BUG #3909: src\tools\msvc\clean.bat clears parse.h file
Previous Message Dave Page 2008-02-05 16:21:46 Re: [BUGS] BUG #3909: src\tools\msvc\clean.bat clears parse.h file