Fix Assert failure for MERGE into a partitioned table with RLS.
authorDean Rasheed <dean.a.rasheed@gmail.com>
Wed, 22 Feb 2023 10:51:34 +0000 (10:51 +0000)
committerDean Rasheed <dean.a.rasheed@gmail.com>
Wed, 22 Feb 2023 10:51:34 +0000 (10:51 +0000)
commit0d3b49d4af7509032c847bfc956aac98d30644bf
tree58c8189d94b2113198a00a60be0b7032c3a09022
parent83a611a259d41e305364b8de58f6b33a63cbda66
Fix Assert failure for MERGE into a partitioned table with RLS.

In ExecInitPartitionInfo(), the Assert when building the WITH CHECK
OPTION list for the new partition assumed that the command would be an
INSERT or UPDATE, but it can also be a MERGE. This can be triggered by
a MERGE into a partitioned table with RLS checks to enforce.

Fix, and back-patch to v15, where MERGE was introduced.

Discussion: https://postgr.es/m/CAEZATCWWFtQmW67F3XTyMU5Am10Oxa_b8oe0x%2BNu5Mo%2BCdRErg%40mail.gmail.com
src/backend/executor/execPartition.c
src/test/regress/expected/merge.out
src/test/regress/sql/merge.sql