mirror of https://github.com/citusdata/citus.git
Improve error message for CREATE SCHEMA .. CREATE TABLE (#7024)
Improve error message for CREATE SCHEMA .. CREATE TABLE when enable_schema_based_sharding is enabled.create_schema_elements
parent
565c5260fd
commit
44e3c3b9c6
|
@ -95,10 +95,11 @@ PostprocessCreateSchemaStmt(Node *node, const char *queryString)
|
||||||
if (CreateSchemaStmtCreatesTable(createSchemaStmt))
|
if (CreateSchemaStmtCreatesTable(createSchemaStmt))
|
||||||
{
|
{
|
||||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
errmsg("cannot create tenant table in CREATE "
|
errmsg("cannot create distributed schema and table in a "
|
||||||
"SCHEMA statement"),
|
"single statement"),
|
||||||
errhint("Use CREATE TABLE statement to create "
|
errhint("SET citus.enable_schema_based_sharding TO off, "
|
||||||
"tenant tables.")));
|
"or create the schema and table in separate "
|
||||||
|
"commands.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -314,8 +314,8 @@ WHERE schemaid::regnamespace::text IN ('tenant_1', 'tenant_2');
|
||||||
|
|
||||||
-- verify that we don't allow creating tenant tables via CREATE SCHEMA command
|
-- verify that we don't allow creating tenant tables via CREATE SCHEMA command
|
||||||
CREATE SCHEMA schema_using_schema_elements CREATE TABLE test_table(a int, b text);
|
CREATE SCHEMA schema_using_schema_elements CREATE TABLE test_table(a int, b text);
|
||||||
ERROR: cannot create tenant table in CREATE SCHEMA statement
|
ERROR: cannot create distributed schema and table in a single statement
|
||||||
HINT: Use CREATE TABLE statement to create tenant tables.
|
HINT: SET citus.enable_schema_based_sharding TO off, or create the schema and table in separate commands.
|
||||||
CREATE SCHEMA tenant_4;
|
CREATE SCHEMA tenant_4;
|
||||||
CREATE TABLE tenant_4.tbl_1(a int, b text);
|
CREATE TABLE tenant_4.tbl_1(a int, b text);
|
||||||
CREATE TABLE tenant_4.tbl_2(a int, b text);
|
CREATE TABLE tenant_4.tbl_2(a int, b text);
|
||||||
|
|
Loading…
Reference in New Issue