Hash: SHA1

(For those unfamiliar with the topic, looking for a way to get the last
inserted OID through a sql call, rather than a method call off the JDBC

On 23-Aug-2001 Barry Lind wrote:
> I would only agree to this functionality if it where a backend function. 

For me, the best method to deal with this problem is implement the returning
clause on the backend... but isn't an option in the short term....

> For the front end to understand the function it needs to parse the SQL 
> statement.  Thus under your proposal every select statement needs to be 
> parsed to see if one of the selected items is the special function.  I 
> strive to ensure that the jdbc code does not need to parse the SQL 
> statements and understand the grammer of the SQL language.  Since 
> functions can appear in select lists, where clauses, orderbys, and even 

This is a problem, I agree.  In short, supporting 'select @@last_oid' (my
original syntax) is not a framework within itself, but a short-term "kludge" as
you mentioned.  

But what are the options that should be pursued?  I want to solve this one way
or another.  (And willing to work on an acceptable solution.)

> Given that the JDBC driver already does provide the information via the 
> getLastOID() method,  we are really dealing with a small isolated 
> problem here because of the use of a connection pool that doesn't let 
> you get at that method.  (Unfortunatly for you, it is the problem you 
> are facing).

Well, it's not really that isolated.  The method call 'getLastOID()' isn't in
the backend either.  That's the problem.  This method provides functionality
which is very useful, but not in a uniformally applied way where each driver
can benefit either.
> If the function was implemented in the backend, I think it would be a 
> good idea.

Perhaps this is the solution after all.  (And the reason I forward this to the
pghackers list as well)  Should the backend support the function
getLastInsertedOID() or even getLastInsertedPrimaryKey() (or both)?  Now, I can
try to write the functions, and see if it can be separated into the contrib
section of the psql repository if people would like.

Does this work for you? (And anyone else reading this)


D08C2F45:  28E7 56CB 58AC C622 5A51  3C42 8B2B 2739 D08C 2F45 
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to