Fix replica identity check for INSERT ON CONFLICT DO UPDATE. If an INSERT has an ON CONFLICT DO UPDATE clause, the executor must check that the target relation supports UPDATE as well as INSERT. In particular, it must check that the target relation has a REPLICA IDENTITY if it publishes updates. Formerly, it was not doing this check, which could lead to silently breaking replication.
Fix by adding such a check to CheckValidResultRel(), which requires adding a new onConflictAction argument. In back-branches, preserve ABI compatibility by introducing a wrapper function with the original signature. Author: Zhijie Hou <[email protected]> Reviewed-by: Ashutosh Bapat <[email protected]> Reviewed-by: Dean Rasheed <[email protected]> Tested-by: Chao Li <[email protected]> Discussion: https://postgr.es/m/os3pr01mb57180c87e43a679a730482df94...@os3pr01mb5718.jpnprd01.prod.outlook.com Backpatch-through: 13 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/5fd569ef2d621d3a36d69b6ceb669866014db39d Modified Files -------------- src/backend/executor/execMain.c | 23 ++++++++++++++++++++++- src/backend/executor/execPartition.c | 8 ++++++-- src/backend/executor/nodeModifyTable.c | 3 ++- src/include/executor/executor.h | 2 ++ src/test/regress/expected/publication.out | 23 +++++++++++++++++++++++ src/test/regress/sql/publication.sql | 26 ++++++++++++++++++++++++++ 6 files changed, 81 insertions(+), 4 deletions(-)
