Re: [PATCH] Partial foreign key updates in referential integrity triggers
Paul Martinez <hellopfm@gmail.com>
From: Paul Martinez <hellopfm@gmail.com>
To: Zhihong Yu <zyu@yugabyte.com>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2021-11-23T04:44:15Z
Lists: pgsql-hackers
Attachments
- referential-actions-on-delete-only-set-cols-v5.patch (application/octet-stream) patch v5
On Mon, Nov 22, 2021 at 10:21 PM Zhihong Yu <zyu@yugabyte.com> wrote:
>
> Hi,
> + If a foreign key with a <literal>SET NULL</literal> or <literal>SET
> + DEFAULT</literal> delete action, which columns should be updated.
>
> which columns should be updated -> the columns that should be updated
Done.
> + if (fk_del_set_cols)
> + {
> + int num_delete_cols = 0;
>
> Since num_delete_cols is only used in the else block, I think it can be moved inside else block.
> Or you can store the value inside *num_fk_del_set_cols directly and avoid num_delete_cols.
I've moved it inside the else block (and removed the initialization).
Updated patch attached. Thanks for taking a look so quickly!
- Paul
Commits
-
Allow specifying column list for foreign key ON DELETE SET actions
- d6f96ed94e73 15.0 landed
-
doc: Add referential actions to CREATE/ALTER TABLE synopsis
- db9f287711ac 15.0 landed