Re: Referential Integrity --> SystemTables

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: "David M(dot) Richter" <d(dot)Richter(at)dkfz-heidelberg(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Referential Integrity --> SystemTables
Date: 2001-09-03 17:28:01
Message-ID: Pine.BSF.4.21.0109031024430.76325-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 3 Sep 2001, David M. Richter wrote:

> Hello!
>
> I want to update a old postgresdatabase. In the time of databasecreation
> the postgres had no "references" construct. So the integrity is
> maintained by the C-Driver.
> Now I want to build in the integrity. But i have to maintain
> compatibiliy to old databases in the code itself.
> So my question:
> HOW can I determine if the database has referential integrity used or
> not? Are there in the database any "references" in use or not?
> Maybe it is descripted in any systemtable(pg_xyz)?

Do you mean determining if it supports it or if this database has
constraints defined? In the former case you pretty much need to do it by
version number probably (7.0+ have it). In the latter case, you need to
parse out the information from pg_trigger (there are three triggers per fk
constraint, most of the interesting information is in the tgargs column)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2001-09-03 17:31:17 Re: Adding a Foreign Key
Previous Message Stephan Szabo 2001-09-03 17:23:38 Re: query not using index