[SCRIPT] pgrefchk -- checks referential integrity of foreign keys on tables

From: "David D(dot) Kilzer" <ddkilzer(at)lubricants-oil(dot)com>
To: pgsql-hackers(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Cc: Debian PostgreSQL Maintainer <Oliver(dot)Elphick(at)lfix(dot)co(dot)uk>
Subject: [SCRIPT] pgrefchk -- checks referential integrity of foreign keys on tables
Date: 2002-09-11 16:14:06
Message-ID: 20020911111406.B15056@elbonia.lubricants-oil.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

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

Attachment Content-Type Size
pgrefchk text/plain 6.8 KB

Browse pgsql-general by date

  From Date Subject
Next Message Oleg Bartunov 2002-09-11 16:15:18 Re: Mailing lists archive search
Previous Message pginfo 2002-09-11 16:00:53 SQL syntax analyze tools wanted

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-09-11 16:37:57 New pgaccess
Previous Message Stephan Szabo 2002-09-11 16:11:19 Re: problem with new autocommit config parameter and jdbc