Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit44170a5

Browse files
committed
Fix potential crash after constraint violation errors in partitioned tables.
During the reporting of constraint violations for partitioned tables,ExecPartitionCheckEmitError(), ExecConstraints(),ExecWithCheckOptions() set the slot descriptor of the input slot tothe root partition's tuple desc. That's generally problematic whenthe slot could be used by other routines, but can cause crashes afterthe introduction of slots with "fixed" tuple descriptors inad7dbee.The problem likely escaped detection so far for two reasons: First,currently the only known way that these routines are used with apartitioned table that is not "owned" by partitioning code is when"fast defaults" are used for the child partition. Second, as an erroris raised afterwards, an "external" slot that had its descriptorchanged, is very unlikely to continue being used.Even though the issue currently is only known to cause a crash for11 (as that has both fast defaults and "fixed" slot descriptors), itseems worth applying the fix to 10 too. Potentially changing randomslots is hazardous.Regression tests will be added in a separate commit, as it seems bestto add them for master and 12 too.Reported-By: Daniel WMAuthor: Andres FreundBug: #16293Discussion:https://postgr.es/m/16293-26f5777d10143a66@postgresql.orgBackpatch: 11, 10 only
1 parenta7500cc commit44170a5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎src/backend/executor/execMain.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,6 +1917,8 @@ ExecPartitionCheck(ResultRelInfo *resultRelInfo, TupleTableSlot *slot,
19171917
if (map!=NULL)
19181918
{
19191919
tuple=do_convert_tuple(tuple,map);
1920+
/* one off slot for building error message */
1921+
slot=MakeTupleTableSlot();
19201922
ExecSetSlotDescriptor(slot,tupdesc);
19211923
ExecStoreTuple(tuple,slot,InvalidBuffer, false);
19221924
}
@@ -1995,6 +1997,8 @@ ExecConstraints(ResultRelInfo *resultRelInfo,
19951997
if (map!=NULL)
19961998
{
19971999
tuple=do_convert_tuple(tuple,map);
2000+
/* one off slot for building error message */
2001+
slot=MakeTupleTableSlot();
19982002
ExecSetSlotDescriptor(slot,tupdesc);
19992003
ExecStoreTuple(tuple,slot,InvalidBuffer, false);
20002004
}
@@ -2043,6 +2047,8 @@ ExecConstraints(ResultRelInfo *resultRelInfo,
20432047
if (map!=NULL)
20442048
{
20452049
tuple=do_convert_tuple(tuple,map);
2050+
/* one off slot for building error message */
2051+
slot=MakeTupleTableSlot();
20462052
ExecSetSlotDescriptor(slot,tupdesc);
20472053
ExecStoreTuple(tuple,slot,InvalidBuffer, false);
20482054
}
@@ -2153,6 +2159,8 @@ ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo,
21532159
if (map!=NULL)
21542160
{
21552161
tuple=do_convert_tuple(tuple,map);
2162+
/* one off slot for building error message */
2163+
slot=MakeTupleTableSlot();
21562164
ExecSetSlotDescriptor(slot,tupdesc);
21572165
ExecStoreTuple(tuple,slot,InvalidBuffer, false);
21582166
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp