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 <[email protected]>
Author: Henson Choi <[email protected]>
Reviewed-by: Prashant Chinnam <[email protected]>
Reviewed-by: Dean Rasheed <[email protected]>
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(-)

Reply via email to