From: | tmp <skrald(at)amossen(dot)dk> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Getting track of foreign keys |
Date: | 2004-09-15 20:07:11 |
Message-ID: | pan.2004.09.15.20.07.10.662756@amossen.dk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I have the following problem:
1) I have one master table with a primary key.
2) In addition I have *several* slave tables, all refering to a primary
key in the master table (no two slave tables refer to the same master key)
I wan't to make sure that no keys in the master table are unreferred, that
is:
* If a slave row is deleted, I wan't to delete the corresponding master
row too. Also if the slave row should be modified as a result of some
cascading effect, I wan't all unreferred master keys to be deleted.
* I have tried to create a trigger, that ensures the above. But this is,
for some reason, not getting fired if the deletion of a slave row is a
result of a foreign key cascading effect. So this is only of limited use.
How can I keep my master table clean - preventing any "leaks"?
For the curios: The master table is a dictionary table and all the slave
tables contains all (dynamically created) content. Hereby all content
can be localised easily.
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2004-09-15 20:59:59 | Re: what is flushed? |
Previous Message | Anony Mous | 2004-09-15 19:52:17 | psql error - "unrecognizable command" V8.0.0 beta |