RT> Hi to all,
RT> Is there any means to get a list of the Primary Keys (or simply the
RT> Primary Key if there's only one :) ) for a given table using an SQL query
RT> ?
RT> Regards,
RT> Roger Tannous.
Something like this?
select (select attname from pg_attribute where attrelid=pg_index.indrelid and pg_attribute.attnum=pg_index.indkey[0])
frompg_indexwhere indisprimary and indrelid=(select oid from pg_class where relname='yourtable');
DAQ