X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C9034528B2 for ; Mon, 20 Jun 2005 07:15:32 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02550-03 for ; Mon, 20 Jun 2005 10:15:24 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id 60ACC528B1 for ; Mon, 20 Jun 2005 07:15:23 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 0B8F1417AF2; Mon, 20 Jun 2005 11:15:19 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id CB96415EDB; Mon, 20 Jun 2005 11:10:42 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 13229-03; Mon, 20 Jun 2005 11:10:39 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id B2D7715F00; Mon, 20 Jun 2005 11:10:10 +0100 (BST) Message-ID: <42B69602.4050309@archonet.com> Date: Mon, 20 Jun 2005 11:10:10 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Luca Rasconi Cc: pgsql-sql@postgresql.org Subject: Re: FW: help with serial References: <000901c5757b$2b3b7030$19040a0a@cefriel.it> In-Reply-To: <000901c5757b$2b3b7030$19040a0a@cefriel.it> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.054 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/254 X-Sequence-Number: 21855 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