Re: [GENERAL] Primary key column numbers...

2005-05-31 Thread Tom Lane
Justin Tocci <[EMAIL PROTECTED]> writes: > SELECT indkey > FROM (SELECT relname, indkey > FROM pg_catalog.pg_index join pg_catalog.pg_class > ON pg_index.indrelid = pg_class.oid > WHERE indisprimary=true > UNION > SELECT viewname, ('{1}')::int2vector[] as indkey > FROM pg_catalog.pg_views ) t

[GENERAL] Primary key column numbers...

2005-05-31 Thread Justin Tocci
What I'm trying to do is IF the relation given is a TABLE, give the primary key column numbers. IF the relation is a VIEW, just give an array with a '1' in it. ELSE NULL. Later I'll put in some hocus-pocus to be more intelligent about VIEWs but right now this would do me fine. I've read the d