44{
48 bool nulls[Natts_pg_namespace];
55
56 /* sanity checks */
57 if (!nspName)
58 elog(
ERROR,
"no namespace name supplied");
59
60 /* make sure there is no existing namespace of same name */
63 (
errcode(ERRCODE_DUPLICATE_SCHEMA),
64 errmsg(
"schema \"%s\" already exists", nspName)));
65
66 if (!isTemp)
69 else
70 nspacl = NULL;
71
74
75 /* initialize nulls and values */
76 for (
i = 0;
i < Natts_pg_namespace;
i++)
77 {
80 }
81
83 Anum_pg_namespace_oid);
88 if (nspacl != NULL)
90 else
91 nulls[Anum_pg_namespace_nspacl - 1] = true;
92
93
95
98
100
101 /* Record dependencies */
102 myself.
classId = NamespaceRelationId;
105
106 /* dependency on owner */
108
109 /* dependencies on roles mentioned in default ACL */
111
112 /* dependency on extension ... but not for magic temp schemas */
113 if (!isTemp)
115
116 /* Post creation hook for new schema */
118
119 return nspoid;
120}
void recordDependencyOnNewAcl(Oid classId, Oid objectId, int32 objsubId, Oid ownerId, Acl *acl)
Acl * get_user_default_acl(ObjectType objtype, Oid ownerId, Oid nsp_oid)
static Datum values[MAXATTR]
#define OidIsValid(objectId)
Oid GetNewOidWithIndex(Relation relation, Oid indexId, AttrNumber oidcolumn)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
Assert(PointerIsAligned(start, uint64))
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
void CatalogTupleInsert(Relation heapRel, HeapTuple tup)
void namestrcpy(Name name, const char *str)
#define InvokeObjectPostCreateHook(classId, objectId, subId)
void recordDependencyOnCurrentExtension(const ObjectAddress *object, bool isReplace)
void recordDependencyOnOwner(Oid classId, Oid objectId, Oid owner)
static Datum PointerGetDatum(const void *X)
static Datum ObjectIdGetDatum(Oid X)
static Datum NameGetDatum(const NameData *X)
#define SearchSysCacheExists1(cacheId, key1)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)