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

Поиск
Список
Период
Сортировка
От Christian von Kietzell
Тема Re: How to get the name of a table's primary key?
Дата
Msg-id 20020316204612.A8716@wh2-227.uni-magdeburg.de
обсуждение исходный текст
Ответ на Re: How to get the name of a table's primary key?  (Darren Ferguson <darren@crystalballinc.com>)
Ответы Re: How to get the name of a table's primary key?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi,

On Fri, Mar 15, 2002 at 11:47:27AM -0500, Darren Ferguson wrote:
> You can give the primary key a name when you are creating the table just
> like you can give indexes, foreign keys, unique etc
>
> create table foo (
>    foo_pkey integer not null,
>    foo_data varchar(50) not null,
>    CONSTRAINT foo_pk PRIMARY KEY(poo_pkey)
> )
> ;
>
> The primary key for this table is called foo_pk

Well, that isn't quite what I meant. I know I can do that. Maybe my
explanation was a bit misleading.

Suppose, I've got the table shown above. I've only got its name. What
I want is the column name the primary key is created on. How can I do
that? Basically, which of foo_pkey and foo_data is the primary key?

Cheers,
  Chris

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

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

Предыдущее
От: "Jonathan Ellis"
Дата:
Сообщение: locking problems
Следующее
От: Tom Lane
Дата:
Сообщение: Re: How to get the name of a table's primary key?