Re: [PATCH] Partial foreign key updates in referential integrity triggers

From: Paul Martinez <hellopfm(at)gmail(dot)com>
To: Zhihong Yu <zyu(at)yugabyte(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Partial foreign key updates in referential integrity triggers
Date: 2021-11-23 04:44:15
Message-ID: CAF+2_SFTfdOK+bXuoCvvhJxLbRwtmZdPy5R6dAu7h=E6Hbu-6w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Nov 22, 2021 at 10:21 PM Zhihong Yu <zyu(at)yugabyte(dot)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 Content-Type Size
referential-actions-on-delete-only-set-cols-v5.patch application/octet-stream 45.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2021-11-23 04:55:46 Re: Sequence's value can be rollback after a crashed recovery.
Previous Message Zhihong Yu 2021-11-23 04:22:42 Re: [PATCH] Partial foreign key updates in referential integrity triggers