diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regproc.c index 59e5dc8..339bfe7 100644 --- a/src/backend/utils/adt/regproc.c +++ b/src/backend/utils/adt/regproc.c @@ -1569,6 +1569,7 @@ Datum regrolein(PG_FUNCTION_ARGS) { char *role_name_or_oid = PG_GETARG_CSTRING(0); + List *names; Oid result; /* '-' ? */ @@ -1586,7 +1587,15 @@ regrolein(PG_FUNCTION_ARGS) } /* Normal case: see if the name matches any pg_authid entry. */ - result = get_role_oid(role_name_or_oid, false); + names = stringToQualifiedNameList(role_name_or_oid); + + if (list_length(names) > 1) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("improper qualified name (too many dotted names): %s", + NameListToString(names)))); + + result = get_role_oid(strVal(linitial(names)), false); PG_RETURN_OID(result); } @@ -1668,7 +1677,9 @@ Datum regnamespacein(PG_FUNCTION_ARGS) { char *nsp_name_or_oid = PG_GETARG_CSTRING(0); + char *nsp_name; Oid result = InvalidOid; + List *names; /* '-' ? */ if (strcmp(nsp_name_or_oid, "-") == 0) @@ -1685,7 +1696,15 @@ regnamespacein(PG_FUNCTION_ARGS) } /* Normal case: see if the name matches any pg_namespace entry. */ - result = get_namespace_oid(nsp_name_or_oid, false); + names = stringToQualifiedNameList(nsp_name_or_oid); + + if (list_length(names) != 1) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("improper qualified name (too many dotted names): %s", + NameListToString(names)))); + + result = get_namespace_oid(nsp_name, false); PG_RETURN_OID(result); }