Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 61B032E37E1 for ; Tue, 22 Jan 2008 03:15:54 -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 63416-03-4 for ; Tue, 22 Jan 2008 03:15:48 -0400 (AST) Received: from moon.antora.ru (moon.antora.ru [217.107.222.210]) by postgresql.org (Postfix) with ESMTP id 23C312E39E8 for ; Tue, 22 Jan 2008 03:15:51 -0400 (AST) Envelope-to: pgsql-sql@postgresql.org Received: from localhost.antora.ru ([127.0.0.1] helo=moon.antora.ru) by moon.antora.ru with esmtps (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1JHDMK-0007iG-TM for pgsql-sql@postgresql.org; Tue, 22 Jan 2008 10:15:48 +0300 Received: from [212.176.226.89] by moon.antora.ru (Axigen) with ESMTPA id 326B34; Tue, 22 Jan 2008 10:15:47 +0300 Message-ID: <4795984E.7030904@bankir.ru> Date: Tue, 22 Jan 2008 10:16:30 +0300 From: silly_sad User-Agent: Thunderbird 2.0.0.4 (X11/20070626) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: currval() within one statement Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/162 X-Sequence-Number: 30015 Helo is it expected that the currval() changes its value between calls within one statement ? Look the following call: INSERT INTO ttt (a,b) SELECT currval('ttt_id_seq'), 'const' FROM ttt2; Where the trigger before insert on ttt is defined and this trigger calls nextval('ttt_id_seq'). I was surprised having different values of currval() in ttt.a Is this the normal behavior ? Where is it described ?