New backend functions? [was Re: JDBC changes for 7.2... some questions...]

From: Ned Wolpert <ned(dot)wolpert(at)knowledgenet(dot)com>
To: Barry Lind <barry(at)xythos(dot)com>, pgsql-hackers(at)postgresql(dot)org
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: New backend functions? [was Re: JDBC changes for 7.2... some questions...]
Date: 2001-08-23 17:42:35
Message-ID: XFMail.20010823104235.ned.wolpert@knowledgenet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

-----BEGIN PGP SIGNED MESSAGE-----
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
driver)

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)

Virtually,
Ned Wolpert <ned(dot)wolpert(at)knowledgenet(dot)com>

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

iD8DBQE7hUCLiysnOdCML0URArdAAJ4kI4S00AVzGgazsGS5nTMu+0X8CwCeOLQ8
TVTTzaQdEt6uJrbVAm0Dd4s=
=U3aZ
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jason.ory 2001-08-23 17:47:01 Toast, Text, blob bytea Huh?
Previous Message Barry Lind 2001-08-23 17:11:18 Re: JDBC changes for 7.2... some questions...

Browse pgsql-jdbc by date

  From Date Subject
Next Message Robert B. Easter 2001-08-23 18:37:27 JDBC patch for util.Serialize and jdbc2.PreparedStatement
Previous Message Barry Lind 2001-08-23 17:11:18 Re: JDBC changes for 7.2... some questions...