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

From: Christian von Kietzell <chris(at)gammu(dot)ath(dot)cx>
To: pgsql-general(at)postgresql(dot)org
Subject: How to get the name of a table's primary key?
Date: 2002-03-15 14:24:10
Message-ID: 20020315152410.A5207@wh2-227.uni-magdeburg.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gammu(dot)ath(dot)cx
Jabber: cuboci(at)charente(dot)de

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Enrico Mangano 2002-03-15 14:28:02 R: [SQL] UPDATE and SELECT result difference
Previous Message Samuele Brignoli 2002-03-15 14:12:29 Bad timestamp external representation '2001-05-11 00.00.00'