aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/commands/collationcmds.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/backend/commands/collationcmds.c b/src/backend/commands/collationcmds.c
index a7ee452e192..55a0e24a35a 100644
--- a/src/backend/commands/collationcmds.c
+++ b/src/backend/commands/collationcmds.c
@@ -407,14 +407,16 @@ pg_import_system_collations(PG_FUNCTION_ARGS)
Oid nspid = PG_GETARG_OID(0);
int ncreated = 0;
- /* silence compiler warning if we have no locale implementation at all */
- (void) nspid;
-
if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("must be superuser to import system collations")));
+ if (!SearchSysCacheExists1(NAMESPACEOID, ObjectIdGetDatum(nspid)))
+ ereport(ERROR,
+ (errcode(ERRCODE_UNDEFINED_SCHEMA),
+ errmsg("schema with OID %u does not exist", nspid)));
+
/* Load collations known to libc, using "locale -a" to enumerate them */
#ifdef READ_LOCALE_A_OUTPUT
{