Re: DELETE CASCADE

From: David Christensen <david(dot)christensen(at)crunchydata(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: DELETE CASCADE
Date: 2021-06-05 12:21:11
Message-ID: 28EA43CF-22BE-4727-A201-AFBDA06CE7B5@crunchydata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> On Jun 5, 2021, at 2:30 AM, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com> wrote:
>
> On 03.06.21 22:49, David Christensen wrote:
>> Presented for discussion is a POC for a DELETE CASCADE functionality, which will allow you one-shot usage of treating existing NO ACTION and RESTRICT FK constraints as if they were originally defined as CASCADE constraints. I can't tell you how many times this functionality would have been useful in the field, and despite the expected answer of "define your constraints right in the first place", this is not always an option, nor is the ability to change that easily (or create new constraints that need to revalidate against big tables) always the best option.
>
> I think, if we think this is useful, the other way around would also be useful: Override a foreign key defined as ON DELETE CASCADE to behave as RESTRICT for a particular command.

I am not opposed to this, but I am struggling to come up with a use case. Where would this be useful?

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Isaac Morland 2021-06-05 12:24:39 Re: DELETE CASCADE
Previous Message Abbas Butt 2021-06-05 11:08:00 Logical replication keepalive flood