On Sun, 14 Nov 1999, Mark Stosberg wrote:
>
> Hello!
>
> I'm writing some perl code to access arbitrary Postgres tables. As part
> of this, I would like to be to tell if a given column is a primary key.
> Given a table and a column name, is there is a select statement I can
> run on the systems tables to tell me whether or not it's a primary key? Thanks.
youd also need to check all the indices for the table; although the field
may not be the pk, it may be in a unique index or part of a unique index.
check psql's source code, which has the appropriate select statements.
---
Howie <caffeine@toodarkpark.org> URL: http://www.toodarkpark.org
"Tell a man that there are 400 billion stars and he'll believe you. Tell him a bench has wet paint and he has to touch
it."