How to get the name of a table's primary key? - Mailing list pgsql-general

From Christian von Kietzell
Subject How to get the name of a table's primary key?
Date
Msg-id 20020315152410.A5207@wh2-227.uni-magdeburg.de
Whole thread Raw
Responses Re: How to get the name of a table's primary key?  (Darren Ferguson <darren@crystalballinc.com>)
List 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 by date:

Previous
From: "Evandro"
Date:
Subject: Drop all databases objects except the database
Next
From: Bruce Momjian
Date:
Subject: Re: Archives / News gateway