Re: How to get the name of a table's primary key?
От | Darren Ferguson |
---|---|
Тема | Re: How to get the name of a table's primary key? |
Дата | |
Msg-id | Pine.LNX.4.10.10203151145450.12478-100000@thread.crystalballinc.com обсуждение исходный текст |
Ответ на | How to get the name of a table's primary key? (Christian von Kietzell <chris@gammu.ath.cx>) |
Ответы |
Re: How to get the name of a table's primary key?
|
Список | pgsql-general |
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 HTH Darren Ferguson On Fri, 15 Mar 2002, Christian von Kietzell wrote: > 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 > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly >
В списке pgsql-general по дате отправления: