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