Re: java.sql.DatabaseMetaData.getProcedures and overloaded functions

From: Thor Michael Støre <thormichael(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kris Jurka <books(at)ejurka(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: java.sql.DatabaseMetaData.getProcedures and overloaded functions
Date: 2011-01-02 20:47:07
Message-ID: 1294001227.4756.306.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Fri, 2010-12-31 at 11:09 -0500, Tom Lane wrote:
> Thor Michael =?ISO-8859-1?Q?St=F8re?= <thormichael(at)gmail(dot)com> writes:
> > Right, it says it should "uniquely" identify the function within the
> > schema, which as far as I can tell means that for overloaded functions
> > it would have to list up the input argument types. (Or at least the
> > other only unique way to identify a function I can think of is the OID,
> > which I can't believe one would want there.)
>
> I'll bet a nickel that the expectation is for this to be pulled from
> information_schema.routines.specific_name, which is defined thusly in
> Postgres:
>
> CAST(p.proname || '_' || CAST(p.oid AS text) AS sql_identifier)
> ... FROM pg_proc p
>
> As best I can tell from the SQL spec, the <specific name> of a function
> is implementation-dependent, so this is a compliant way of doing it.

Aah, wasn't aware of that, that makes sense.

Also, I see SPECIFIC_NAME was added to JDBC 4, so I imagine that to
correctly add it one would override getProcedures and
getProcedureColumns in
org.postgresql.jdbc4.AbstractJdbc4DatabaseMetaData and have them return
the additional column(s). I took a look at the code and it seem straight
forward enough for getProcedures, but getProcedureColumns has six other
new columns as well and seems a bit hairier so I'm not sure if should
throw myself over adding this.

Thanks either way to everyone, I quite understand the state of things
now.

- thormick

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2011-01-03 19:23:00 Re: java.sql.DatabaseMetaData.getProcedures and overloaded functions
Previous Message Tom Lane 2010-12-31 16:09:21 Re: java.sql.DatabaseMetaData.getProcedures and overloaded functions