Re: A Table's Primary Key Listing

Поиск
Список
Период
Сортировка
От daq
Тема Re: A Table's Primary Key Listing
Дата
Msg-id 170626266203.20050818172958@ugyvitelszolgaltato.hu
обсуждение исходный текст
Ответ на A Table's Primary Key Listing  (Roger Tannous <roger77_lb@yahoo.com>)
Список pgsql-sql
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



В списке pgsql-sql по дате отправления:

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: A Table's Primary Key Listing
Следующее
От: "D'Arcy J.M. Cain"
Дата:
Сообщение: Re: A Table's Primary Key Listing