mirror of https://github.com/citusdata/citus.git
Merge pull request #2599 from citusdata/fix_fk_from_partition_to_reference
Fix partitioned table operations involving foreign key to reference tablepull/2598/head
commit
913cac2391
|
@ -1185,6 +1185,26 @@ SetupExecutionModeForAlterTable(Oid relationId, AlterTableCmd *command)
|
||||||
{
|
{
|
||||||
executeSequentially = true;
|
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