Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 906FE2E0127 for ; Tue, 22 Jan 2008 05:13:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 94303-10 for ; Tue, 22 Jan 2008 05:13:29 -0400 (AST) Received: from sd-2317.dedibox.fr (sd-2317.dedibox.fr [88.191.17.192]) by postgresql.org (Postfix) with ESMTP id D454E2E009E for ; Tue, 22 Jan 2008 05:13:33 -0400 (AST) Received: from [192.168.10.1] (ASte-Genev-Bois-153-1-15-217.w83-112.abo.wanadoo.fr [83.112.195.217]) by sd-2317.dedibox.fr (Postfix) with ESMTP id 62B8BB2B7; Tue, 22 Jan 2008 10:13:31 +0100 (CET) Message-ID: <4795B3B6.5040004@lelarge.info> Date: Tue, 22 Jan 2008 10:13:26 +0100 From: Guillaume Lelarge User-Agent: Thunderbird 2.0.0.9 (X11/20071112) MIME-Version: 1.0 To: sad CC: pgsql-sql@postgresql.org Subject: Re: currval() within one statement References: <4795984E.7030904@bankir.ru> <20080122073637.GB21676@a-kretschmer.de> <4795A152.3080400@bankir.ru> In-Reply-To: <4795A152.3080400@bankir.ru> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/166 X-Sequence-Number: 30019 sad wrote: > A. Kretschmer wrote: > >>> is it expected that the currval() changes its value between calls >>> within one statement ? > >> Conclusion, don't call nextval() within a TRIGGER, and insert either >> nextval() for the column or omit this column. > > I only note that i still want to discuss the titled problem or to be > given an exact pointer to documentation regarding the currval() behavior > in the described situation, that i had. > Well, your situation is weird, to say the least. currval() doesn't change the value of a sequence. Adding a trigger that calls nextval() will change the value. But you're not telling us which kind of trigger... per statement or for each row ? if it's for each row, then that's quite understandable. BTW, sequence functions are described here : http://www.postgresql.org/docs/8.2/interactive/functions-sequence.html Regards. -- Guillaume. http://www.postgresqlfr.org http://dalibo.com