Re: listing all tables without primary key

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Jeff Frost <jeff(at)frostconsultingllc(dot)com>
Cc: SF Postgres <sfpug(at)postgresql(dot)org>
Subject: Re: listing all tables without primary key
Date: 2005-05-17 01:08:31
Message-ID: 200505161808.31844.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: sfpug

Jeff,

> Is there a simple way to list all tables without a primary key? Googling
> on this subject has not turned up any helpful sources thus far.

Check out the "newsysviews" project on www.pgfoundry.org. We have a few
views related to keys which you can mine (you'll have to look in CVS, there
have been no releases yet). For example, check out:
http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/newsysviews/newsysview/sql/#dirlist

The view pg_table_constraints lets you find primary keys. If you do an outer
join against pg_user_tables, you can find out which are incomplete.

--
--Josh

Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Responses

Browse sfpug by date

  From Date Subject
Next Message Jeff Frost 2005-05-17 01:13:40 Re: listing all tables without primary key
Previous Message David Fetter 2005-05-17 01:05:55 Re: listing all tables without primary key