mirror of https://github.com/citusdata/citus.git
Set sequential mode execution GUC for alter partitioned table
PG recently started propagating foreign key constraints
to partition tables. This came with a select query
to validate the the constaint.
We are already setting sequential mode execution for this
command. In order for validation select query to respect
this setting we need to explicitly set the GUC.
This commit also handles detach partition part.
(cherry picked from commit cd5213abee
)
release-8.1
parent
4d5225eb30
commit
3fa08f6622
|
@ -1192,6 +1192,26 @@ SetupExecutionModeForAlterTable(Oid relationId, AlterTableCmd *command)
|
|||
{
|
||||
executeSequentially = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Postgres performs additional selects when creating constraints
|
||||
* on partitioned tables. We need to set execution mode to
|
||||
* sequential for the select query so that ddl connections
|
||||
* we open does not fail due to previous select.
|
||||
*/
|
||||
if (executeSequentially && PartitionedTable(relationId))
|
||||
{
|
||||
SetLocalMultiShardModifyModeToSequential();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (alterTableType == AT_DetachPartition)
|
||||
{
|
||||
/* check if there are foreign constraints to reference tables */
|
||||
if (HasForeignKeyToReferenceTable(relationId))
|
||||
{
|
||||
executeSequentially = true;
|
||||
SetLocalMultiShardModifyModeToSequential();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue