mirror of https://github.com/citusdata/citus.git
Support schema elements in CREATE SCHEMA statements
parent
4312486141
commit
6eb8e6cce1
|
@ -44,6 +44,7 @@ static ObjectAddress GetObjectAddressBySchemaName(char *schemaName, bool missing
|
||||||
static List * FilterDistributedSchemas(List *schemas);
|
static List * FilterDistributedSchemas(List *schemas);
|
||||||
static bool SchemaHasDistributedTableWithFKey(char *schemaName);
|
static bool SchemaHasDistributedTableWithFKey(char *schemaName);
|
||||||
static bool ShouldPropagateCreateSchemaStmt(void);
|
static bool ShouldPropagateCreateSchemaStmt(void);
|
||||||
|
static void NoticeIfCreateSchemaStmtHasSchemaElements(Node *node);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -63,6 +64,8 @@ PreprocessCreateSchemaStmt(Node *node, const char *queryString,
|
||||||
|
|
||||||
EnsureSequentialMode(OBJECT_SCHEMA);
|
EnsureSequentialMode(OBJECT_SCHEMA);
|
||||||
|
|
||||||
|
NoticeIfCreateSchemaStmtHasSchemaElements(node);
|
||||||
|
|
||||||
/* deparse sql*/
|
/* deparse sql*/
|
||||||
const char *sql = DeparseTreeNode(node);
|
const char *sql = DeparseTreeNode(node);
|
||||||
|
|
||||||
|
@ -392,3 +395,17 @@ ShouldPropagateCreateSchemaStmt()
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
NoticeIfCreateSchemaStmtHasSchemaElements(Node *node)
|
||||||
|
{
|
||||||
|
CreateSchemaStmt *stmt = castNode(CreateSchemaStmt, node);
|
||||||
|
|
||||||
|
if (list_length(stmt->schemaElts) > 0)
|
||||||
|
{
|
||||||
|
ereport(NOTICE, (errmsg("schema elements will not be distributed"),
|
||||||
|
errdetail("Citus does not propagate other CREATE commands in "
|
||||||
|
"CREATE SCHEMA statements")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -87,11 +87,6 @@ DeparseAlterSchemaRenameStmt(Node *node)
|
||||||
static void
|
static void
|
||||||
AppendCreateSchemaStmt(StringInfo buf, CreateSchemaStmt *stmt)
|
AppendCreateSchemaStmt(StringInfo buf, CreateSchemaStmt *stmt)
|
||||||
{
|
{
|
||||||
if (stmt->schemaElts != NIL)
|
|
||||||
{
|
|
||||||
elog(ERROR, "schema creating is not supported with other create commands");
|
|
||||||
}
|
|
||||||
|
|
||||||
appendStringInfoString(buf, "CREATE SCHEMA ");
|
appendStringInfoString(buf, "CREATE SCHEMA ");
|
||||||
|
|
||||||
if (stmt->if_not_exists)
|
if (stmt->if_not_exists)
|
||||||
|
|
Loading…
Reference in New Issue