Skip to content

Commit 9bc3332

Browse files
committed
Improve error message annotation for GRANT/REVOKE on untrusted PLs.
The annotation for "ERROR: language "foo" is not trusted" used to say "HINT: Only superusers can use untrusted languages", which was fairly poorly thought out. For one thing, it's not a hint about what to do, but a statement of fact, which makes it errdetail. But also, this fails to clarify things much, because there's a missing step in the chain of reasoning. I think it's more useful to say "GRANT and REVOKE are not allowed on untrusted languages, because only superusers can use untrusted languages". It's been like this for a long time, but given the lack of previous complaints, I don't think this is worth back-patching. Discussion: <1417.1466289901@sss.pgh.pa.us>
1 parent a3f42e8 commit 9bc3332

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/backend/catalog/aclchk.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2592,7 +2592,8 @@ ExecGrant_Language(InternalGrant *istmt)
25922592
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
25932593
errmsg("language \"%s\" is not trusted",
25942594
NameStr(pg_language_tuple->lanname)),
2595-
errhint("Only superusers can use untrusted languages.")));
2595+
errdetail("GRANT and REVOKE are not allowed on untrusted languages, "
2596+
"because only superusers can use untrusted languages.")));
25962597

25972598
/*
25982599
* Get owner ID and working copy of existing ACL. If there's no ACL,

src/test/regress/expected/privileges.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ REVOKE ALL PRIVILEGES ON LANGUAGE sql FROM PUBLIC;
536536
GRANT USAGE ON LANGUAGE sql TO regressuser1; -- ok
537537
GRANT USAGE ON LANGUAGE c TO PUBLIC; -- fail
538538
ERROR: language "c" is not trusted
539-
HINT: Only superusers can use untrusted languages.
539+
DETAIL: GRANT and REVOKE are not allowed on untrusted languages, because only superusers can use untrusted languages.
540540
SET SESSION AUTHORIZATION regressuser1;
541541
GRANT USAGE ON LANGUAGE sql TO regressuser2; -- fail
542542
WARNING: no privileges were granted for "sql"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy