45 bool collisdeterministic,
47 const char *collcollate,
const char *collctype,
48 const char *colllocale,
49 const char *collicurules,
50 const char *collversion,
58 bool nulls[Natts_pg_collation];
67 Assert((collprovider == COLLPROVIDER_LIBC &&
68 collcollate && collctype && !colllocale) ||
69 (collprovider != COLLPROVIDER_LIBC &&
70 !collcollate && !collctype && colllocale));
80 Anum_pg_collation_oid,
88 else if (if_not_exists)
101 ?
errmsg(
"collation \"%s\" already exists, skipping",
103 :
errmsg(
"collation \"%s\" for encoding \"%s\" already exists, skipping",
111 ?
errmsg(
"collation \"%s\" already exists",
113 :
errmsg(
"collation \"%s\" for encoding \"%s\" already exists",
127 if (collencoding == -1)
129 Anum_pg_collation_oid,
135 Anum_pg_collation_oid,
146 else if (if_not_exists)
159 errmsg(
"collation \"%s\" already exists, skipping",
166 errmsg(
"collation \"%s\" already exists",
173 memset(nulls, 0,
sizeof(nulls));
177 Anum_pg_collation_oid);
183 values[Anum_pg_collation_collisdeterministic - 1] =
BoolGetDatum(collisdeterministic);
188 nulls[Anum_pg_collation_collcollate - 1] =
true;
192 nulls[Anum_pg_collation_collctype - 1] =
true;
196 nulls[Anum_pg_collation_colllocale - 1] =
true;
200 nulls[Anum_pg_collation_collicurules - 1] =
true;
204 nulls[Anum_pg_collation_collversion - 1] =
true;
213 myself.
classId = CollationRelationId;
218 referenced.
classId = NamespaceRelationId;
219 referenced.
objectId = collnamespace;
static Datum values[MAXATTR]
#define CStringGetTextDatum(s)
#define Assert(condition)
#define OidIsValid(objectId)
Oid GetNewOidWithIndex(Relation relation, Oid indexId, AttrNumber oidcolumn)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
void heap_freetuple(HeapTuple htup)
void CatalogTupleInsert(Relation heapRel, HeapTuple tup)
#define ShareRowExclusiveLock
int GetDatabaseEncoding(void)
void namestrcpy(Name name, const char *str)
#define InvokeObjectPostCreateHook(classId, objectId, subId)
#define ObjectAddressSet(addr, class_id, object_id)
Oid CollationCreate(const char *collname, Oid collnamespace, Oid collowner, char collprovider, bool collisdeterministic, int32 collencoding, const char *collcollate, const char *collctype, const char *colllocale, const char *collicurules, const char *collversion, bool if_not_exists, bool quiet)
void checkMembershipInCurrentExtension(const ObjectAddress *object)
void recordDependencyOn(const ObjectAddress *depender, const ObjectAddress *referenced, DependencyType behavior)
void recordDependencyOnCurrentExtension(const ObjectAddress *object, bool isReplace)
void recordDependencyOnOwner(Oid classId, Oid objectId, Oid owner)
#define pg_encoding_to_char
static Datum PointerGetDatum(const void *X)
static Datum BoolGetDatum(bool X)
static Datum ObjectIdGetDatum(Oid X)
static Datum NameGetDatum(const NameData *X)
static Datum Int32GetDatum(int32 X)
static Datum CharGetDatum(char X)
#define RelationGetDescr(relation)
#define ERRCODE_DUPLICATE_OBJECT
#define GetSysCacheOid3(cacheId, oidcol, key1, key2, key3)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)