| From: | Ken Johanson <pg-user(at)kensystem(dot)com> |
|---|---|
| To: | pgsql-jdbc(at)postgresql(dot)org |
| Subject: | Re: Patch for Statement.getGeneratedKeys() |
| Date: | 2008-01-16 08:12:13 |
| Message-ID: | 478DBC5D.30607@kensystem.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | tivvpgsqljdbc | 2008-01-16 09:30:22 | Re: Patch for Statement.getGeneratedKeys() |
| Previous Message | Ken Johanson | 2008-01-16 07:44:09 | Re: Query to get column-names in table via PG tables? |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | tivvpgsqljdbc | 2008-01-16 09:30:22 | Re: Patch for Statement.getGeneratedKeys() |
| Previous Message | Tom Lane | 2008-01-16 07:38:37 | Re: Patch for Statement.getGeneratedKeys() |