Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 7157D9FB580 for ; Sun, 21 Jan 2007 20:53:03 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 50074-08 for ; Sun, 21 Jan 2007 20:53:00 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from www01.kensystem.com (www01.kensystem.com [72.19.170.120]) by postgresql.org (Postfix) with ESMTP id 152779FA5AB for ; Sun, 21 Jan 2007 20:52:58 -0400 (AST) Received: from 192.168.0.3 by www01.kensystem.com (SMTPD); id s20070122005249.8953; Mon, 22 Jan 2007 00:52:49 Message-ID: <45B40AE1.8020003@kensystem.com> Date: Sun, 21 Jan 2007 17:52:49 -0700 From: Ken Johanson User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: Dave Cramer CC: Michael Paesold , pgsql-jdbc@postgresql.org Subject: Re: Synthesize support for Statement.getGeneratedKeys()? References: <4580E681.3080106@kensystem.com> <45810230.80803@gmx.at> <45B1AC19.3090300@kensystem.com> <45B1F839.3060402@gmx.at> <45B254D7.4080304@kensystem.com> <55027648-0777-4BE4-8581-933E86180539@fastcrypt.com> <45B3B9CB.3070308@kensystem.com> <3C6B3C20-CD94-4D35-B146-27DA78E6E462@fastcrypt.com> In-Reply-To: <3C6B3C20-CD94-4D35-B146-27DA78E6E462@fastcrypt.com> 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: 200701/136 X-Sequence-Number: 16501 >>>> 4) If 3b is required, then besides incrementing (by one) sequences, >>>> any suggestions on how to correctly synthesize other increment >>>> values? Other key types (OIDs, etc?) >>> Are you suggesting here that you are planning on incrementing the >>> sequences by 1 ? Why not just let the insert occur and get the >>> currval of the sequence ? >> >> I'm thinking what you're thinking; get the current value; however the >> increment I mention is just in case I cant get more than one curval... >> I don't know, can I get 3 values from RETURN if I insert three VALUEs >> in one query?? > hmmm good question, one which I doubt the Sun people thought about. I > wouldn't bother trying to return any more than the last one. >> Well, unless server generated keys can only be numeric (increment by one, i.e predictable) (which is the only kind I've used), then I think it's essential that we somehow can get each of the generated keys. As for Sun/others, I do know that this feature works well in other dbms's - every one I've used supports it, and with multiple rows inserted. But I've only ever used numeric server generated keys so I don't know if other types are supported on those DBs. As an aside, how do PG jdbc users get the server generated keys? Or does everyone use some kind of UUID system (which I think is generally regarded as detrimental to indexes/memory under high load and large DB sizes - compared to int/bigint)? Or do PG users using some standard or server-specific (RETURNING) SQL clause? ken