Use schema name in the error msg

pull/6965/head
ahmet gedemenli 2023-06-02 15:25:14 +03:00
parent fccfee08b6
commit 2bd6ff0e93
2 changed files with 7 additions and 6 deletions

View File

@ -254,6 +254,7 @@ ErrorIfTenantTable(Oid relationId, char *operationName)
if (IsTenantSchema(get_rel_namespace(relationId)))
{
ereport(ERROR, (errmsg("%s is not allowed for %s because it is a tenant table",
get_rel_name(relationId), operationName)));
generate_qualified_relation_name(relationId),
operationName)));
}
}

View File

@ -76,19 +76,19 @@ SELECT citus_add_local_table_to_metadata('tenant_2.test_table');
ERROR: table "test_table" is already distributed
-- verify we don't allow update_distributed_table_colocation for tenant tables
SELECT update_distributed_table_colocation('tenant_2.test_table', colocate_with => 'none');
ERROR: test_table is not allowed for update_distributed_table_colocation because it is a tenant table
ERROR: tenant_2.test_table is not allowed for update_distributed_table_colocation because it is 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');
ERROR: test_table is not allowed for colocate_with because it is a tenant table
ERROR: tenant_2.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
ERROR: tenant_2.test_table is not allowed for undistribute_table because it is a tenant table
-- verify we don't allow alter_distributed_table for tenant tables
SELECT alter_distributed_table('tenant_2.test_table', colocate_with => 'none');
ERROR: test_table is not allowed for alter_distributed_table because it is a tenant table
ERROR: tenant_2.test_table is not allowed for alter_distributed_table because it is a tenant table
-- verify we also don't allow colocate_with a tenant table
SELECT alter_distributed_table('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: tenant_2.test_table is not allowed for colocate_with 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');