Re: FW: help with serial

From: Richard Huxton <dev(at)archonet(dot)com>
To: Luca Rasconi <luca(dot)rasconi(at)students(dot)cefriel(dot)it>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: FW: help with serial
Date: 2005-06-20 10:10:10
Message-ID: 42B69602.4050309@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Luca Rasconi wrote:
>
> CREATE OR REPLACE RULE r1 AS
> ON INSERT TO TABLE_A DO INSERT INTO TABLE_B (uid)
> VALUES ((new.uid));

> how is it possible, why in a table 37 and in the other 37 + 1?

This is almost certainly the "nextval() evaluated twice" issue that
catches everyone out from time to time. Check the mailing-list archives
for discussion - it's because the rule acts as a macro, duplicating the
expression.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Theodore Petrosky 2005-06-20 12:29:03 Re: info
Previous Message Richard Huxton 2005-06-20 10:08:30 Re: info