aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2011-03-04 22:14:37 +0200
committerPeter Eisentraut <peter_e@gmx.net>2011-03-04 22:14:37 +0200
commit4442e1975d3c4c96a0b573b7abd864b0cbe26f9d (patch)
tree7103b3d57c7e6e6fd49d0fccc0fc16c977097855 /src/backend/commands
parentbd58d9d883111ee84de4af480ebb018fe9b0bf27 (diff)
downloadpostgresql-4442e1975d3c4c96a0b573b7abd864b0cbe26f9d.tar.gz
postgresql-4442e1975d3c4c96a0b573b7abd864b0cbe26f9d.zip
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.
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/collationcmds.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/backend/commands/collationcmds.c b/src/backend/commands/collationcmds.c
index 6db72d919cc..18e88d2653f 100644
--- a/src/backend/commands/collationcmds.c
+++ b/src/backend/commands/collationcmds.c
@@ -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);
}
/*