#include "commands/alter.h"
#include "commands/comment.h"
#include "commands/extension.h"
+#include "commands/schemacmds.h"
#include "commands/trigger.h"
#include "executor/executor.h"
#include "funcapi.h"
if (schemaOid == InvalidOid)
{
- schemaOid = NamespaceCreate(schemaName, extowner);
- /* Advance cmd counter to make the namespace visible */
- CommandCounterIncrement();
+ CreateSchemaStmt *csstmt = makeNode(CreateSchemaStmt);
+
+ csstmt->schemaname = schemaName;
+ csstmt->authid = NULL; /* will be created by current user */
+ csstmt->schemaElts = NIL;
+ CreateSchemaCommand(csstmt, NULL);
+
+ /*
+ * CreateSchemaCommand includes CommandCounterIncrement, so new
+ * schema is now visible
+ */
+ schemaOid = get_namespace_oid(schemaName, false);
}
}
else