mirror of
https://github.com/postgres/postgres.git
synced 2025-06-27 23:21:58 +03:00
Fix RETURNING to work correctly with partition tuple routing.
In ExecInsert(), do not switch back to the root partitioned table ResultRelInfo until after we finish ExecProcessReturning(), so that RETURNING projection is done using the partition's descriptor. For the projection to work correctly, we must initialize the same for each leaf partition during ModifyTableState initialization. Amit Langote
This commit is contained in:
@ -1279,10 +1279,10 @@ InitResultRelInfo(ResultRelInfo *resultRelInfo,
|
||||
/*
|
||||
* This is not our own partition constraint, but rather an ancestor's.
|
||||
* So any Vars in it bear the ancestor's attribute numbers. We must
|
||||
* switch them to our own.
|
||||
* switch them to our own. (dummy varno = 1)
|
||||
*/
|
||||
if (partition_check != NIL)
|
||||
partition_check = map_partition_varattnos(partition_check,
|
||||
partition_check = map_partition_varattnos(partition_check, 1,
|
||||
resultRelationDesc,
|
||||
partition_root);
|
||||
}
|
||||
|
Reference in New Issue
Block a user