Re: Synthesize support for Statement.getGeneratedKeys()? - Mailing list pgsql-jdbc

From Ken Johanson
Subject Re: Synthesize support for Statement.getGeneratedKeys()?
Date
Msg-id 45B40AE1.8020003@kensystem.com
Whole thread Raw
In response to Re: Synthesize support for Statement.getGeneratedKeys()?  (Dave Cramer <pg@fastcrypt.com>)
Responses Re: Synthesize support for Statement.getGeneratedKeys()?
List pgsql-jdbc
>>>> 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



pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: Synthesize support for Statement.getGeneratedKeys()?
Next
From: Dave Cramer
Date:
Subject: Re: Synthesize support for Statement.getGeneratedKeys()?