Re: Supporting MERGE on updatable views

Dean Rasheed <dean.a.rasheed@gmail.com>

From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-02-07T10:03:46Z
Lists: pgsql-hackers

Attachments

On Sat, 21 Jan 2023 at 11:03, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
>
> Rebased version, following 5d29d525ff.
>

Updated version attached.

This needed a little extra tweaking to work following the change to
make Vars outer-join aware, so it's worth checking that I understood
that properly -- when merging into a trigger-updatable view, the
whole-row Var added to the targetlist by the rewriter is nullable by
the join added by transform_MERGE_to_join().

The make-Vars-outer-join-aware patch has possibly made this patch's
change to preprocess_targetlist() unnecessary, but I left it in just
in case, even though I can no longer trigger that failure mode. It
feels safer, and more consistent with the code later on in that
function.

Regards,
Dean

Commits

  1. Support MERGE into updatable views.

  2. Remove field UpdateContext->updated in nodeModifyTable.c

  3. Remove dummy_spinlock