Referential Integrity --> SystemTables
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
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)