Re: [PATCH] Partial foreign key updates in referential integrity triggers - Mailing list pgsql-hackers

From Paul Martinez
Subject Re: [PATCH] Partial foreign key updates in referential integrity triggers
Date
Msg-id CAF+2_SFTfdOK+bXuoCvvhJxLbRwtmZdPy5R6dAu7h=E6Hbu-6w@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Partial foreign key updates in referential integrity triggers  (Zhihong Yu <zyu@yugabyte.com>)
Responses Re: [PATCH] Partial foreign key updates in referential integrity triggers
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: Zhihong Yu
Date:
Subject: Re: [PATCH] Partial foreign key updates in referential integrity triggers
Next
From: Tomas Vondra
Date:
Subject: Re: Sequence's value can be rollback after a crashed recovery.