How to identify which column in a table is the primary key - Mailing list pgsql-general

From Scot L. Harris
Subject How to identify which column in a table is the primary key
Date
Msg-id 1086112215.22794.49.camel@lathe
Whole thread Raw
Responses Re: How to identify which column in a table is the primary key
List pgsql-general
I am using Postgresql 7.2.4 and php 4.2.2 to write some generic
functions to access and manipulate all tables in a database.

I have been looking for a way to identify the primary key defined in a
table.  The closest I have found is a filed in the pg_class table that
is a boolean that tells me if that table has or every had a primary
key.

So given the table name is there a way to identify the column defined as
the primary key for that table?

--
Scot L. Harris <webid@cfl.rr.com>


pgsql-general by date:

Previous
From: "Campano, Troy"
Date:
Subject: Databases on separate filesystems
Next
From: Thomas Schoen
Date:
Subject: ORDER BY with plpgsql parameter