From 2bd6ff0e93c09f32fe534a40554bbdac23d3f390 Mon Sep 17 00:00:00 2001 From: ahmet gedemenli Date: Fri, 2 Jun 2023 15:25:14 +0300 Subject: [PATCH] Use schema name in the error msg --- .../distributed/commands/schema_based_sharding.c | 3 ++- src/test/regress/expected/schema_based_sharding.out | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/backend/distributed/commands/schema_based_sharding.c b/src/backend/distributed/commands/schema_based_sharding.c index f33debb34..b7f1ba70a 100644 --- a/src/backend/distributed/commands/schema_based_sharding.c +++ b/src/backend/distributed/commands/schema_based_sharding.c @@ -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))); } } diff --git a/src/test/regress/expected/schema_based_sharding.out b/src/test/regress/expected/schema_based_sharding.out index 84ca562e3..e55b1cd2b 100644 --- a/src/test/regress/expected/schema_based_sharding.out +++ b/src/test/regress/expected/schema_based_sharding.out @@ -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');