pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Record dependencies on the target columns of MERGE actions.
Date: Mon, 23 Nov 2026 19:22:42 +0000
Message-ID: <E1xVZcg-000000003Xy-0QuB@gemulon.postgresql.org> (raw)

Record dependencies on the target columns of MERGE actions.

For an INSERT or UPDATE query, we add a dependency on each target
column, to guard against things like dropping the column or altering
its type, but MERGE didn't get the memo.

Fix by also adding a dependency on each target column of each INSERT
or UPDATE action of a MERGE query.

Backpatch to v15, where MERGE was introduced.

Note: This won't fix existing rules or SQL-standard function bodies,
unless they're re-created.

Reported-by: Henson Choi <assam258@gmail.com>
Author: Henson Choi <assam258@gmail.com>
Reviewed-by: Prashant Chinnam <crprashant@hotmail.com>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Discussion: https://postgr.es/m/CAAAe_zBHzEFR9bFSiJYfve7%3DQoWG_cL8%2BTWxx8vz47Jy0kUSHQ%40mail.gmail.com
Backpatch-through: 15

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2df3d9e2b042dd8cebb65ccbbb515ff583443a9f

Modified Files
--------------
src/backend/catalog/dependency.c                  | 52 +++++++++++++++++------
src/test/regress/expected/create_function_sql.out | 43 +++++++++++++++++++
src/test/regress/expected/rules.out               | 44 +++++++++++++++++++
src/test/regress/sql/create_function_sql.sql      | 21 +++++++++
src/test/regress/sql/rules.sql                    | 19 +++++++++
5 files changed, 166 insertions(+), 13 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1xVZcg-000000003Xy-0QuB@gemulon.postgresql.org>
Permalink:  ../E1xVZcg-000000003Xy-0QuB@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xVZcg-000000003Xy-0QuB@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: dean.a.rasheed@gmail.com
  Subject: Re: pgsql: Record dependencies on the target columns of MERGE actions.
  In-Reply-To: <E1xVZcg-000000003Xy-0QuB@gemulon.postgresql.org>
  References: <E1xVZcg-000000003Xy-0QuB@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox