How to get the name of a table's primary key?

Поиск
Список
Период
Сортировка
От Christian von Kietzell
Тема How to get the name of a table's primary key?
Дата
Msg-id 20020315152410.A5207@wh2-227.uni-magdeburg.de
обсуждение исходный текст
Ответы Re: How to get the name of a table's primary key?
Список pgsql-general
Hi,

I'm sorry if this is a stupid question, but how can I obtain the name
of a primary key of a given table? Suppose I've got a simple table
like this:

create table foo (
  foo_pkey int primary key,
  foo_data varchar(50)
);

In a programme I only know the table name "foo" and want to get the
name of the primary key.
Any help on this?

Cheers,
  Chris

--
Christian von Kietzell
mailto: chris@gammu.ath.cx
Jabber: cuboci@charente.de

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

Предыдущее
От: "Evandro"
Дата:
Сообщение: Drop all databases objects except the database
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Archives / News gateway