18#include <unicode/uloc.h>
90 foreach(
pl, parameters)
105 else if (
strcmp(
defel->defname,
"deterministic") == 0)
115 errmsg(
"collation attribute \"%s\" not recognized",
128 errmsg(
"conflicting or redundant options"),
129 errdetail(
"LOCALE cannot be specified together with LC_COLLATE or LC_CTYPE."));
134 errmsg(
"conflicting or redundant options"),
135 errdetail(
"FROM cannot be specified together with any other options."));
194 errmsg(
"collation \"default\" cannot be copied")));
230 errmsg(
"unrecognized collation provider: %s",
258 errmsg(
"parameter \"%s\" must be specified",
269 errmsg(
"parameter \"%s\" must be specified",
275 errmsg(
"parameter \"%s\" must be specified",
283 errmsg(
"parameter \"%s\" must be specified",
298 (
errmsg(
"using standard form \"%s\" for ICU locale \"%s\"",
317 errmsg(
"nondeterministic collations not supported with this provider")));
322 errmsg(
"ICU rules cannot be specified unless locale provider is ICU")));
345 errmsg(
"current database's encoding is not supported with this provider")));
410 errmsg(
"collation \"%s\" for encoding \"%s\" already exists in schema \"%s\"",
421 errmsg(
"collation \"%s\" already exists in schema \"%s\"",
446 (
errmsg(
"cannot refresh version of default collation"),
449 "ALTER DATABASE ... REFRESH COLLATION VERSION")));
457 elog(
ERROR,
"cache lookup failed for collation %u", collOid);
473 elog(
ERROR,
"invalid collation version change");
481 (
errmsg(
"changing version from %s to %s",
485 memset(nulls,
false,
sizeof(nulls));
496 (
errmsg(
"version has not changed")));
555 errmsg(
"collation with OID %u does not exist",
collid)));
584#define READ_LOCALE_A_OUTPUT
589#define ENUM_SYSTEM_LOCALE
593#ifdef READ_LOCALE_A_OUTPUT
613 while ((*
o >=
'A' && *
o <=
'Z')
614 || (*
o >=
'a' && *
o <=
'z')
615 || (*
o >=
'0' && *
o <=
'9')
715 elog(
DEBUG1,
"skipping locale with non-ASCII name: \"%s\"", locale);
722 elog(
DEBUG1,
"skipping locale with unrecognized encoding: \"%s\"", locale);
727 elog(
DEBUG1,
"skipping locale with client-only encoding: \"%s\"", locale);
761#ifdef ENUM_SYSTEM_LOCALE
801 param->nvalidp, param->ncreatedp);
815 for (
char *p = alias; *p; p++)
826 (*param->ncreatedp)++;
849 errmsg(
"must be superuser to import system collations")));
854 errmsg(
"schema with OID %u does not exist",
nspid)));
857#ifdef READ_LOCALE_A_OUTPUT
877 errmsg(
"could not execute command \"%s\": %m",
950 char *alias = aliases[
i].
alias;
969 (
errmsg(
"no usable system locales were found")));
1034#ifdef ENUM_SYSTEM_LOCALE
1039 param.nspid =
nspid;
1054 (
errmsg(
"no usable system locales were found")));
void aclcheck_error(AclResult aclerr, ObjectType objtype, const char *objectname)
AclResult object_aclcheck(Oid classid, Oid objectid, Oid roleid, AclMode mode)
bool object_ownercheck(Oid classid, Oid objectid, Oid roleid)
static Datum values[MAXATTR]
#define CStringGetTextDatum(s)
#define TextDatumGetCString(d)
#define Assert(condition)
#define OidIsValid(objectId)
Datum pg_collation_actual_version(PG_FUNCTION_ARGS)
static bool normalize_libc_locale_name(char *new, const char *old)
static int cmpaliases(const void *a, const void *b)
pg_attribute_unused() static int create_collation_from_locale(const char *locale
ObjectAddress AlterCollation(AlterCollationStmt *stmt)
void IsThereCollationInNamespace(const char *collname, Oid nspOid)
Datum pg_import_system_collations(PG_FUNCTION_ARGS)
ObjectAddress DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_exists)
void check_encoding_locale_matches(int encoding, const char *collate, const char *ctype)
char * defGetString(DefElem *def)
bool defGetBoolean(DefElem *def)
List * defGetQualifiedName(DefElem *def)
void errorConflictingDefElem(DefElem *defel, ParseState *pstate)
int errcode_for_file_access(void)
int errdetail(const char *fmt,...)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
bool is_encoding_supported_by_icu(int encoding)
FILE * OpenPipeStream(const char *command, const char *mode)
int ClosePipeStream(FILE *file)
#define PG_RETURN_TEXT_P(x)
#define PG_RETURN_INT32(x)
HeapTuple heap_modify_tuple(HeapTuple tuple, TupleDesc tupleDesc, const Datum *replValues, const bool *replIsnull, const bool *doReplace)
void heap_freetuple(HeapTuple htup)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
void CatalogTupleUpdate(Relation heapRel, const ItemPointerData *otid, HeapTuple tup)
char * get_namespace_name(Oid nspid)
int GetDatabaseEncoding(void)
const char * GetDatabaseEncodingName(void)
char * pstrdup(const char *in)
void * repalloc(void *pointer, Size size)
char * NameListToString(const List *names)
Oid QualifiedNameGetCreationNamespace(const List *names, char **objname_p)
Oid get_collation_oid(List *collname, bool missing_ok)
#define InvokeObjectPostAlterHook(classId, objectId, subId)
const ObjectAddress InvalidObjectAddress
#define ObjectAddressSet(addr, class_id, object_id)
int parser_errposition(ParseState *pstate, int location)
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)
FormData_pg_collation * Form_pg_collation
FormData_pg_database * Form_pg_database
#define lfirst_node(type, lc)
static int list_length(const List *l)
void icu_validate_locale(const char *loc_str)
char * get_collation_actual_version(char collprovider, const char *collcollate)
pg_locale_t pg_newlocale_from_collation(Oid collid)
int builtin_locale_encoding(const char *locale)
char * icu_language_tag(const char *loc_str, int elevel)
const char * builtin_validate_locale(int encoding, const char *locale)
#define LOCALE_NAME_BUFLEN
#define PG_VALID_BE_ENCODING(_enc)
int pg_strcasecmp(const char *s1, const char *s2)
int pg_get_encoding_from_locale(const char *ctype, bool write_message)
#define qsort(a, b, c, d)
static Datum ObjectIdGetDatum(Oid X)
static Datum CStringGetDatum(const char *X)
static Datum Int32GetDatum(int32 X)
char * psprintf(const char *fmt,...)
#define RelationGetDescr(relation)
#define ERRCODE_DUPLICATE_OBJECT
bool pg_is_ascii(const char *str)
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
Datum SysCacheGetAttrNotNull(int cacheId, HeapTuple tup, AttrNumber attributeNumber)
#define SearchSysCacheCopy1(cacheId, key1)
#define SearchSysCacheExists1(cacheId, key1)
#define SearchSysCacheExists3(cacheId, key1, key2, key3)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
text * cstring_to_text(const char *s)
void _dosmaperr(unsigned long)
void CommandCounterIncrement(void)