Disable undistribute_table for tenant tables

pull/6965/head
ahmet gedemenli 2023-06-02 14:08:03 +03:00
parent f4b2494d0c
commit 4b67e398b1
3 changed files with 7 additions and 0 deletions

View File

@ -380,6 +380,8 @@ UndistributeTable(TableConversionParameters *params)
"because the table is not distributed")));
}
ErrorIfTenantTable(params->relationId, "undistribute_table");
if (!params->cascadeViaForeignKeys)
{
EnsureTableNotReferencing(params->relationId, UNDISTRIBUTE_TABLE);

View File

@ -80,6 +80,9 @@ ERROR: test_table is not allowed for update_distributed_table_colocation becaus
-- verify we also don't allow colocate_with a tenant table
SELECT update_distributed_table_colocation('regular_schema.test_table', colocate_with => 'tenant_2.test_table');
ERROR: test_table is not allowed for colocate_with because it is a tenant table
-- verify we don't allow undistribute_table for tenant tables
SELECT undistribute_table('tenant_2.test_table');
ERROR: test_table is not allowed for undistribute_table because it is a tenant table
-- (on coordinator) verify that colocation id is set for empty tenants too
SELECT colocationid > 0 FROM pg_dist_tenant_schema
WHERE schemaid::regnamespace::text IN ('tenant_1', 'tenant_3');

View File

@ -59,6 +59,8 @@ SELECT citus_add_local_table_to_metadata('tenant_2.test_table');
SELECT update_distributed_table_colocation('tenant_2.test_table', colocate_with => 'none');
-- verify we also don't allow colocate_with a tenant table
SELECT update_distributed_table_colocation('regular_schema.test_table', colocate_with => 'tenant_2.test_table');
-- verify we don't allow undistribute_table for tenant tables
SELECT undistribute_table('tenant_2.test_table');
-- (on coordinator) verify that colocation id is set for empty tenants too
SELECT colocationid > 0 FROM pg_dist_tenant_schema