Ken Johanson <pg-user@kensystem.com> writes:
> 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
I'd do "where attrelid = ... and attnum > 0 and not attisdropped".
Not sure what you think the attstattarget condition would accompllish,
but it doesn't seem like anything that client-side code ought to be
touching.
regards, tom lane