Attached is a perl script called 'pgrefchk'.  It checks the referential
integrity of foreign keys on tables in a PostgreSQL database using the
PG_TABLES, PG_PROC, PG_CLASS and PG_TRIGGER system "tables".

It was created in the same vein as the pguniqchk script which checks the
uniqueness of unique constraints on tables in a PostgreSQL database.

Why would this be useful?

If you're planning to dump and restore the database, or if you suspect
the state of data in your database after having hard drive issues, this
might be a good sanity check to run.

If nothing else, it's a good example of how to query PostgreSQL system
tables.

NOTES:

- Only tested on PostgreSQL 7.1.3.

Dave
Wed, 11 Sep 2002 11:14:06 -0500
"David D. Kilzer" <ddkilzer@lubricants-oil.com>
[SCRIPT] pgrefchk -- checks referential integrity of foreign keys on
	tables