Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9bc3332

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 fairlypoorly 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, thisfails to clarify things much, because there's a missing step in thechain of reasoning. I think it's more useful to say "GRANT and REVOKEare not allowed on untrusted languages, because only superusers can useuntrusted languages".It's been like this for a long time, but given the lack of previouscomplaints, I don't think this is worth back-patching.Discussion: <1417.1466289901@sss.pgh.pa.us>
1 parenta3f42e8 commit9bc3332

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)

[8]ページ先頭

©2009-2025 Movatter.jp