pgsql: Fix confusion about number of subplans in partitioned INSERT set

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix confusion about number of subplans in partitioned INSERT set
Date: 2017-06-13 03:30:05
Message-ID: E1dKcWr-00045a-NF@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix confusion about number of subplans in partitioned INSERT setup.

ExecInitModifyTable() thought there was a plan per partition, but no,
there's only one. The problem had escaped detection so far because there
would only be visible misbehavior if there were a SubPlan (not an InitPlan)
in the quals being duplicated for each partition. However, valgrind
detected a bogus memory access in test cases added by commit 4f7a95be2,
and investigation of that led to discovery of the bug. The additional
test case added here crashes without the patch.

Patch by Amit Langote, test case by me.

Discussion: https://postgr.es/m/10974.1497227727@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/78a030a441966d91bc7e932ef84da39c3ea7d970

Modified Files
--------------
src/backend/executor/nodeModifyTable.c | 21 ++++++++++++++++-----
src/test/regress/expected/rowsecurity.out | 8 ++++++++
src/test/regress/sql/rowsecurity.sql | 9 +++++++++
3 files changed, 33 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Langote 2017-06-13 04:20:15 Re: pgsql: Apply RLS policies to partitioned tables.
Previous Message Peter Eisentraut 2017-06-13 03:06:57 pgsql: pg_dump: Fix harmless type mixup