]> granicus.if.org Git - postgresql/commit
Fix partition tuple routing with dropped attributes
authorMichael Paquier <michael@paquier.xyz>
Mon, 8 Apr 2019 04:45:14 +0000 (13:45 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 8 Apr 2019 04:45:14 +0000 (13:45 +0900)
commit6b0208ebc436b33bd80ce264299b4b1b8d59b68a
tree566066d2fc3ff822ce37e20d236c8b9ceadac906
parenta7ca25cf787c563a92eef5eff1a8d2bb1364a992
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
src/backend/executor/execPartition.c
src/test/regress/expected/insert.out
src/test/regress/sql/insert.sql