Re: [PROPOSAL] ON DELETE SET NULL (<column_list>) for Foreign Key Constraints

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Paul Martinez <hellopfm(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PROPOSAL] ON DELETE SET NULL (<column_list>) for Foreign Key Constraints
Date: 2019-01-20 01:12:10
Message-ID: 25367.1547946730@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Paul Martinez <hellopfm(at)gmail(dot)com> writes:
> I have a proposal for a feature to add to Postgres. I believe it is a natural
> extension to the current standard SQL ON DELETE SET NULL behavior when using
> composite foreign keys. The basic idea is that you can specify which columns to
> set to NULL in the DELETE trigger created by a foreign key constraint.

This seems like kind of a kluge, because it can only work in MATCH SIMPLE
mode, not MATCH FULL or MATCH PARTIAL. (We don't have MATCH PARTIAL atm,
but it's in the spec so I imagine somebody will get around to implementing
it someday. Anyway MATCH FULL is there now.) In the latter two modes,
setting a subset of the referencing columns to null isn't sufficient to
make the row pass the constraint.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2019-01-20 01:12:36 Re: Ryu floating point output patch
Previous Message Vik Fearing 2019-01-20 01:11:19 Re: pg_stat_statements vs. SELECT FOR UPDATE