Re: Synthesize support for Statement.getGeneratedKeys()?

From: Ken Johanson <pg-user(at)kensystem(dot)com>
To: Dave Cramer <pg(at)fastcrypt(dot)com>
Cc: Michael Paesold <mpaesold(at)gmx(dot)at>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Synthesize support for Statement.getGeneratedKeys()?
Date: 2007-01-22 00:52:49
Message-ID: 45B40AE1.8020003@kensystem.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2007-01-22 02:29:52 Re: Synthesize support for Statement.getGeneratedKeys()?
Previous Message Dave Cramer 2007-01-22 00:21:38 Re: Synthesize support for Statement.getGeneratedKeys()?