mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
When creating a collation, check that the locales can be loaded
This is the same check that would happen later when the collation is used, but it's friendlier to check the collation already when it is created.
This commit is contained in:
@ -15,6 +15,7 @@
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/heapam.h"
|
||||
#include "access/xact.h"
|
||||
#include "catalog/dependency.h"
|
||||
#include "catalog/indexing.h"
|
||||
#include "catalog/namespace.h"
|
||||
@ -30,6 +31,7 @@
|
||||
#include "utils/acl.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/pg_locale.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
static void AlterCollationOwner_internal(Relation rel, Oid collationOid,
|
||||
@ -51,6 +53,7 @@ DefineCollation(List *names, List *parameters)
|
||||
DefElem *lcctypeEl = NULL;
|
||||
char *collcollate = NULL;
|
||||
char *collctype = NULL;
|
||||
Oid newoid;
|
||||
|
||||
collNamespace = QualifiedNameGetCreationNamespace(names, &collName);
|
||||
|
||||
@ -130,12 +133,16 @@ DefineCollation(List *names, List *parameters)
|
||||
|
||||
check_encoding_locale_matches(GetDatabaseEncoding(), collcollate, collctype);
|
||||
|
||||
CollationCreate(collName,
|
||||
newoid = CollationCreate(collName,
|
||||
collNamespace,
|
||||
GetUserId(),
|
||||
GetDatabaseEncoding(),
|
||||
collcollate,
|
||||
collctype);
|
||||
|
||||
/* check that the locales can be loaded */
|
||||
CommandCounterIncrement();
|
||||
pg_newlocale_from_collation(newoid);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user