Re: Patch for Statement.getGeneratedKeys() - Mailing list pgsql-jdbc

From Ken Johanson
Subject Re: Patch for Statement.getGeneratedKeys()
Date
Msg-id 478DBC5D.30607@kensystem.com
Whole thread Raw
In response to Re: Patch for Statement.getGeneratedKeys()  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Patch for Statement.getGeneratedKeys()  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-jdbc
Tom Lane wrote:
> Right.  I suggest using regclass to obtain the OID of the referenced
> table, which then allows direct lookup in pg_attribute and other
> relevant catalogs.  Something along the line of
>
>     select attname from pg_attribute where attrelid = 't'::regclass
>


Here is what I have so far (not sure of my conditionals yet or if I need
any joins for them):

select attname from pg_attribute
where attrelid = 'postgres.public.test'::regclass
and attstattarget=-1
and attisdropped='f'
order by attnum asc

Very simple and elegant, you guys rule.

Couple things I want to verify - will this regclass method have any
cases where security would make it less reliable than say, using pg_*?
Also compatibility issues?: are there any server or session/driver modes
that would somehow prevent this from working?

ken



pgsql-jdbc by date:

Previous
From: Tom Lane
Date:
Subject: Re: Patch for Statement.getGeneratedKeys()
Next
From: tivvpgsqljdbc@gtech-ua.com
Date:
Subject: Re: Patch for Statement.getGeneratedKeys()