Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Interfaces Jdbc > Re: Patch for S...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 1868 of 1984
Post > Topic >>

Re: Patch for Statement.getGeneratedKeys()

by books@[EMAIL PROTECTED] (Kris Jurka) Jan 16, 2008 at 02:20 AM

On Wed, 16 Jan 2008, Ken Johanson wrote:

>> I've lost track of the context in which this needs to be done, but in
>> some cases a cast to or from regclass offers a painless way to
>> disambiguate table names.  Just a suggestion ...
>
> Tom, can you offer an example of this and how the overall goal might be 
> achieved? Kris, please jump in where I'm missing anything:

Regclass is actually exactly what you need.  This let's us skip all kinds 
of parsing, deducing, ...

SELECT 'database.schema.table'::regclass::oid;
SELECT 'schema.table'::regclass::oid;
SELECT 'table'::regclass::oid;
SELECT '"database".schema."table"'::regclass::oid;

will all return the same thing, the oid for the qualified table, or if 
unqualified, the first matching table on the search path.  The oid will be

pg_class.oid which can then easily be used to lookup the columns in 
pg_attribute as people have explained on -general.

> #Questions:
>
> -would the regclass-cast technique (I have no experience with it) work 
> directly in the RETURNING or need to be in the [information_schema]
query? 
> Can you point me to examples?

Needs to be in a separate query.

> -would it be feasible to modify RETURNING in new server versions to
accept 
> indexes as args? That would obviate this whole discussion.
>

Not really, RETURNING is an arbitrary SELECT list, so you can say things 
like RETURNING 1, 2+columnA, f(columnB).  You could potentially add some 
kind of keyword like RETURNING INDEXES 1,2,7, but I doubt the server 
people have a great desire to sup****t something this braindead for just 
one client API to use.

Kris Jurka

---------------------------(end of broadcast)---------------------------
TIP 7: You can help sup****t the PostgreSQL project by donating at

                http://www.postgresql.org/about/donate
 




 1 Posts in Topic:
Re: Patch for Statement.getGeneratedKeys()
books@[EMAIL PROTECTED]   2008-01-16 02:20:28 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 6 19:02:55 CDT 2008.