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.pull/2599/head
parent
1f4f6ea041
commit
cd5213abee
|
@ -1185,6 +1185,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