identify Tables without primary keys - postgres

From: akp geek <akpgeek(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: identify Tables without primary keys - postgres
Date: 2010-01-15 16:39:25
Message-ID: 2024a9fb1001150839x3a0b259djcb3f0e03ccc207fa@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear all -

I have the following query to find the tables with primary
keys. can you please help me finding the tables without primary key.

select
distinct x.table_name,
from
information_schema.constraint_column_usage x,
pg_constraint b
where
b.contype='p' and
x.constraint_name=b.conname

Regards

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rodrigo Gonzalez 2010-01-15 16:45:26 Re: identify Tables without primary keys - postgres
Previous Message Tom Lane 2010-01-15 15:51:12 Re: Creation of tablespaces