Convert all to CLT if a child gets converted

support-partitioning-for-citus-local-tables
Ahmet Gedemenli 2021-08-20 15:36:12 +03:00
parent e851b537be
commit 81eb1fc166
1 changed files with 16 additions and 0 deletions

View File

@ -130,6 +130,22 @@ citus_add_local_table_to_metadata_internal(Oid relationId, bool cascadeViaForeig
"to 'off' to disable this behavior"))); "to 'off' to disable this behavior")));
} }
/*
* If the relation is a partition, we need to convert all the partitioned table
* to Citus Local Table. To do that, we call CreateCitusLocalTable with the parent
* relation, instead of the child, since this will cause the parent and all the
* partition child tables to become a Citus Local Table.
*/
if (PartitionTable(relationId))
{
Oid parentOid = PartitionParentOid(relationId);
if (OidIsValid(parentOid) && !IsCitusTable(parentOid))
{
CreateCitusLocalTable(parentOid, cascadeViaForeignKeys);
return;
}
}
CreateCitusLocalTable(relationId, cascadeViaForeignKeys); CreateCitusLocalTable(relationId, cascadeViaForeignKeys);
} }