Re: Is it possible to have a cascade upwards query?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Mike Martin <redtux1(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Is it possible to have a cascade upwards query?
Date: 2019-03-27 16:37:03
Message-ID: CAKFQuwavGC2X+T-w-6W=1CRtOsPAhfAUSTf2pYsOE4fFYw92AA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Mar 27, 2019 at 8:58 AM Mike Martin <redtux1(at)gmail(dot)com> wrote:

> Scenario being two tables with a linking pair of fields, where one table
> is a superset of the other and key is generated by the second table
>
> I would like to have the record in table two deleted when I delete the
> record in table 1
>

Since table 1 is a superset of table 2 there is no foreign key possible on
which the system provided ON DELETE CASCADE could be specified. You will
need to create your own trigger to perform the deletion on table 2.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sridhar N Bamandlapally 2019-03-28 08:20:07 Case Insensitive
Previous Message Adrian Klaver 2019-03-27 16:23:36 Re: plctl extension issue postgresql 11.2