On Sun, Oct 31, 2004 at 03:37:26PM +0000, Ralph Heinkel wrote:
> 
> I think this is a bug (I hope not a feature). 

It's a feature.

> For each insert into table 'tmp' the serial counter is increased
> twice, once to create the entry in 'tmp', once for 'log'. The problem
> is that the rule does not see the correct 'storage_id'!!!

Rules are macros, so when you refer to NEW.storage_id in the rule
then the default expression "nextval('tmp_storage_id_seq')" is
evaluated again.  If you don't want that to happen then use a
trigger.

This comes up often -- maybe somebody could add it to the FAQ.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to