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
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/30d95d7318e79e1816065f75cbe7f1d31d427f97

Modified Files
--------------
src/backend/catalog/dependency.c                  | 56 ++++++++++++++++++-----
src/test/regress/expected/create_function_sql.out | 43 +++++++++++++++++
src/test/regress/sql/create_function_sql.sql      | 21 +++++++++
3 files changed, 108 insertions(+), 12 deletions(-)

Reply via email to