check for primary key

From: Tom Brown <brown(at)esteem(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: check for primary key
Date: 2009-11-09 19:19:56
Message-ID: 1257794396.18623.415.camel@brown.esteem.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hey guys!

I would like to know how to query for the existence of a primary key on
a table. All of the tables have the column 'id' in them. That should be
the primary key. However, the primary key constraint got "lost" somehow.
Probably due to stupidity on my part.

I just want to add back the primary key constraint to the tables that
lost it. I want to query for the existance of it first, so I don't
produce an error when I do an 'ALTER TABLE ...' statement.

Any suggestions appreciated.

Thanks!
Tom

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tim Uckun 2009-11-09 20:18:14 Re: I can't seem to put the right combination of magic into the pg_hba and pg_ident files.
Previous Message hubert depesz lubaczewski 2009-11-09 19:16:56 What to install to be able to build docs on Arch Linux?