pgsql: Fix partition tuple routing with dropped attributes - Mailing list pgsql-committers

From Michael Paquier
Subject pgsql: Fix partition tuple routing with dropped attributes
Date
Msg-id E1hDMAh-0005YN-N9@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix partition tuple routing with dropped attributes

When trying to insert a tuple into a partitioned table, the routing to
the correct partition has been messed up by mixing when a tuple needs to
be stored in an intermediate parent's slot and when a tuple needs to be
converted because of attribute changes between the immediate parent
relation and the parent relation one level above that (the grandparent).
This could trigger errors like the following:
ERROR: cannot extract attribute from empty tuple slot SQL state: XX000

This was not detected because regression tests with dropped attributes
only included tests with two levels of partitioning, and this can be
triggered with three levels or more.

This fixes bug #15733, which has been introduced by 34295b8.  The bug
happens only on REL_11_STABLE and HEAD gains the regression tests added
for this bug.

Reported-by: Petr Fedorov
Author: Amit Langote, Michael Paquier
Discussion: https://postgr.es/m/15733-7692379e310b80ec@postgresql.org

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6b0208ebc436b33bd80ce264299b4b1b8d59b68a

Modified Files
--------------
src/backend/executor/execPartition.c | 39 +++++++++++++++++++++-------------
src/test/regress/expected/insert.out | 41 ++++++++++++++++++++++++++++++++++++
src/test/regress/sql/insert.sql      | 28 ++++++++++++++++++++++++
3 files changed, 93 insertions(+), 15 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Avoid fetching past the end of the indoption array.
Next
From: Andres Freund
Date:
Subject: pgsql: Fix a number of issues around modifying a previously updatedrow