pgsql: Fix Assert failure for MERGE into a partitioned table with RLS.

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix Assert failure for MERGE into a partitioned table with RLS.
Date: 2023-02-22 10:56:59
Message-ID: E1pUmny-0007L3-Sm@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d8c3b65db58db0a074dc9f7e27846e22e9dc579f

Modified Files
--------------
src/backend/executor/execPartition.c | 10 +++++++---
src/test/regress/expected/merge.out | 12 ++++++++++++
src/test/regress/sql/merge.sql | 12 ++++++++++++
3 files changed, 31 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Dean Rasheed 2023-02-22 13:32:34 pgsql: Add missing support for the latest SPI status codes.
Previous Message John Naylor 2023-02-22 10:29:17 pgsql: Remove newly added asserts from pg_bitutils.h