From: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
---|---|
To: | mailing(dot)lists(at)octgsoftware(dot)com, pgsql-general(at)postgresql(dot)org |
Subject: | Re: ON DELETE CASCADE Question |
Date: | 2013-11-04 20:01:58 |
Message-ID: | 5277FD36.2050401@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 11/04/2013 11:44 AM, Jason Long wrote:
> I would like for corresponding records in t_a to be deleted when I
> delete a record from t_b. This deletes from t_b when I delete from t_a,
> but not the other way around. I am unable to create a foreign key
> constraint on t_a because this table holds records from several other
> tables. I added a simple script below that demonstrates my problem.
As I sent my previous post, it dawned on me what I think you where
trying to say. That the id field has values that have relevance to
tables other than t_b and would not be accepted by a FK to ta_b. In
other words what you are looking for is a conditional FK relationship
between t_a and t_b. AFAIK to get that you will have to roll your own
trigger on t_b.
--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Amiel | 2013-11-04 20:15:45 | Re: table lock when where clause uses unique constraing instead of primary key. |
Previous Message | Adrian Klaver | 2013-11-04 19:55:45 | Re: ON DELETE CASCADE Question |