Referential Integrity --> SystemTables

Started by David M. Richterover 24 years ago2 messagesgeneral
Jump to latest
#1David M. Richter
D.Richter@DKFZ-heidelberg.de

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)?

Thanks in advance

David

#2Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: David M. Richter (#1)
Re: Referential Integrity --> SystemTables

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)