Fix an oversight in cbc127917 to handle MERGE correctly
authorAmit Langote <[email protected]>
Mon, 17 Feb 2025 07:12:03 +0000 (16:12 +0900)
committerAmit Langote <[email protected]>
Mon, 17 Feb 2025 07:12:03 +0000 (16:12 +0900)
commit75dfde13639a57513e23e58c961a69c5bbf017b6
treea026576f9ca96cce1f6b79005e219cfdddbc6f7b
parent6a8a7ce476bd5f042999a04a0d767b38ea6faec0
Fix an oversight in cbc127917 to handle MERGE correctly

ExecInitModifyTable() forgot to trim MERGE-related lists to exclude
entries for result relations pruned during initial pruning, so fix
that.

While at it, make the function's use of the pruned resultRelations
list, rather than ModifyTable.resultRelations, more consistent.

Reported-by: Alexander Lakhin <[email protected]> (via sqlsmith)
Reviewed-by: Junwang Zhao <[email protected]>
Discussion: https://postgr.es/m/e72c94d9-e5f9-4753-9bc1-69d72bd54b8a@gmail.com
src/backend/executor/nodeModifyTable.c
src/include/nodes/execnodes.h
src/test/regress/expected/partition_prune.out
src/test/regress/sql/partition_prune.sql