Re: How to identify which column in a table is the primary key

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: How to identify which column in a table is the primary key
Дата
Msg-id 4938.1086117781@sss.pgh.pa.us
обсуждение исходный текст
Ответ на How to identify which column in a table is the primary key  ("Scot L. Harris" <webid@cfl.rr.com>)
Список pgsql-general
"Scot L. Harris" <webid@cfl.rr.com> writes:
> So given the table name is there a way to identify the column defined as
> the primary key for that table?

You need to look in pg_index.

Note that the primary key could be a multicolumn index, so starting with
the assumption that there is "the column" is going to lead you on the
wrong track.

            regards, tom lane

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

Предыдущее
От: Frank Finner
Дата:
Сообщение: Re: Disappointing news
Следующее
От: Mike Nolan
Дата:
Сообщение: Re: Running Totals and other stuff....