mirror of https://github.com/citusdata/citus.git
Disable undistribute_table for tenant tables
parent
f4b2494d0c
commit
4b67e398b1
|
@ -380,6 +380,8 @@ UndistributeTable(TableConversionParameters *params)
|
||||||
"because the table is not distributed")));
|
"because the table is not distributed")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ErrorIfTenantTable(params->relationId, "undistribute_table");
|
||||||
|
|
||||||
if (!params->cascadeViaForeignKeys)
|
if (!params->cascadeViaForeignKeys)
|
||||||
{
|
{
|
||||||
EnsureTableNotReferencing(params->relationId, UNDISTRIBUTE_TABLE);
|
EnsureTableNotReferencing(params->relationId, UNDISTRIBUTE_TABLE);
|
||||||
|
|
|
@ -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
|
-- 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');
|
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
|
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
|
-- (on coordinator) verify that colocation id is set for empty tenants too
|
||||||
SELECT colocationid > 0 FROM pg_dist_tenant_schema
|
SELECT colocationid > 0 FROM pg_dist_tenant_schema
|
||||||
WHERE schemaid::regnamespace::text IN ('tenant_1', 'tenant_3');
|
WHERE schemaid::regnamespace::text IN ('tenant_1', 'tenant_3');
|
||||||
|
|
|
@ -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');
|
SELECT update_distributed_table_colocation('tenant_2.test_table', colocate_with => 'none');
|
||||||
-- verify we also don't allow colocate_with a tenant table
|
-- 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');
|
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
|
-- (on coordinator) verify that colocation id is set for empty tenants too
|
||||||
SELECT colocationid > 0 FROM pg_dist_tenant_schema
|
SELECT colocationid > 0 FROM pg_dist_tenant_schema
|
||||||
|
|
Loading…
Reference in New Issue