X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id AC441D1B462 for ; Tue, 30 Dec 2003 23:29:08 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 86484-01 for ; Tue, 30 Dec 2003 19:28:22 -0400 (AST) Received: from ideafix.webnow.com.br (ideafix.webnow.com.br [200.155.4.67]) by svr1.postgresql.org (Postfix) with ESMTP id A0042D1B449 for ; Tue, 30 Dec 2003 19:28:19 -0400 (AST) Received: by ideafix.webnow.com.br (Postfix, from userid 48) id AF20B1C4053; Tue, 30 Dec 2003 21:28:21 -0200 (BRST) Received: from 148100.cps.virtua.com.br ([200.174.148.100]) (SquirrelMail authenticated user marcus.magalhaes@vlinfo.com.br) by webmail.webnow.com.br with HTTP; Tue, 30 Dec 2003 21:28:21 -0200 (BRST) Message-ID: <63735.200.174.148.100.1072826901.squirrel@webmail.webnow.com.br> Date: Tue, 30 Dec 2003 21:28:21 -0200 (BRST) Subject: Re: getGeneratedKeys() From: "Marcus Andree S. Magalhaes" To: In-Reply-To: <33309.213.89.23.209.1072826327.squirrel@www.dsv.su.se> References: <3FF1C0EE.4010107@dsv.su.se> <32899.213.89.23.209.1072821322.squirrel@www.dsv.su.se> <1216.192.168.0.64.1072824461.squirrel@mercury.wardbrook.com> <33309.213.89.23.209.1072826327.squirrel@www.dsv.su.se> X-Priority: 3 Importance: Normal Cc: , X-Mailer: SquirrelMail (version 1.2.11) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/200 X-Sequence-Number: 8936 Guys, I am too dumb or a simple currval() would be useful? We solved this by sending two queries in JDBC. The first one inserts a single record in the db. The other issues a currval on the desired sequence. There was a posting a few weeks ago, describing a clever method, issuing both queries on the same connection by using the ";" operator to separate the queries. hope this helps. >> Can you do the insert using a function instead, and return the currval >> on the underlying sequence? >> >> John >> > > I'm not sure what you mean. A stored procedure? > > The good thing about getGeneratedKeys() is that you don't have to write > DB-specific code. > -- > Henrik > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org