Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 39a584d

Browse files
committed
Error message wording improvements
1 parent dda9f8e commit 39a584d

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

src/backend/commands/user.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -323,25 +323,25 @@ CreateRole(ParseState *pstate, CreateRoleStmt *stmt)
323323
ereport(ERROR,
324324
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
325325
errmsg("permission denied to create role"),
326-
errdetail("Only roles with the %s attribute may create roles with %s.",
326+
errdetail("Only roles with the %s attribute may create roles with the %s attribute.",
327327
"SUPERUSER", "SUPERUSER")));
328328
if (createdb && !have_createdb_privilege())
329329
ereport(ERROR,
330330
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
331331
errmsg("permission denied to create role"),
332-
errdetail("Only roles with the %s attribute may create roles with %s.",
332+
errdetail("Only roles with the %s attribute may create roles with the %s attribute.",
333333
"CREATEDB", "CREATEDB")));
334334
if (isreplication && !has_rolreplication(currentUserId))
335335
ereport(ERROR,
336336
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
337337
errmsg("permission denied to create role"),
338-
errdetail("Only roles with the %s attribute may create roles with %s.",
338+
errdetail("Only roles with the %s attribute may create roles with the %s attribute.",
339339
"REPLICATION", "REPLICATION")));
340340
if (bypassrls && !has_bypassrls_privilege(currentUserId))
341341
ereport(ERROR,
342342
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
343343
errmsg("permission denied to create role"),
344-
errdetail("Only roles with the %s attribute may create roles with %s.",
344+
errdetail("Only roles with the %s attribute may create roles with the %s attribute.",
345345
"BYPASSRLS", "BYPASSRLS")));
346346
}
347347

@@ -758,7 +758,7 @@ AlterRole(ParseState *pstate, AlterRoleStmt *stmt)
758758
ereport(ERROR,
759759
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
760760
errmsg("permission denied to alter role"),
761-
errdetail("Only roles with the %s attribute may alter roles with %s.",
761+
errdetail("Only roles with the %s attribute may alter roles with the %s attribute.",
762762
"SUPERUSER", "SUPERUSER")));
763763
if (!superuser() && dissuper)
764764
ereport(ERROR,
@@ -1031,7 +1031,7 @@ AlterRoleSet(AlterRoleSetStmt *stmt)
10311031
ereport(ERROR,
10321032
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
10331033
errmsg("permission denied to alter role"),
1034-
errdetail("Only roles with the %s attribute may alter roles with %s.",
1034+
errdetail("Only roles with the %s attribute may alter roles with the %s attribute.",
10351035
"SUPERUSER", "SUPERUSER")));
10361036
}
10371037
else
@@ -1171,7 +1171,7 @@ DropRole(DropRoleStmt *stmt)
11711171
ereport(ERROR,
11721172
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
11731173
errmsg("permission denied to drop role"),
1174-
errdetail("Only roles with the %s attribute may drop roles with %s.",
1174+
errdetail("Only roles with the %s attribute may drop roles with the %s attribute.",
11751175
"SUPERUSER", "SUPERUSER")));
11761176
if (!is_admin_of_role(GetUserId(), roleid))
11771177
ereport(ERROR,
@@ -1426,7 +1426,7 @@ RenameRole(const char *oldname, const char *newname)
14261426
ereport(ERROR,
14271427
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
14281428
errmsg("permission denied to rename role"),
1429-
errdetail("Only roles with the %s attribute may rename roles with %s.",
1429+
errdetail("Only roles with the %s attribute may rename roles with the %s attribute.",
14301430
"SUPERUSER", "SUPERUSER")));
14311431
}
14321432
else
@@ -2141,14 +2141,14 @@ check_role_membership_authorization(Oid currentUserId, Oid roleid,
21412141
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
21422142
errmsg("permission denied to grant role \"%s\"",
21432143
GetUserNameFromId(roleid, false)),
2144-
errdetail("Only roles with the %s attribute may grant roles with %s.",
2144+
errdetail("Only roles with the %s attribute may grant roles with the %s attribute.",
21452145
"SUPERUSER", "SUPERUSER")));
21462146
else
21472147
ereport(ERROR,
21482148
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
21492149
errmsg("permission denied to revoke role \"%s\"",
21502150
GetUserNameFromId(roleid, false)),
2151-
errdetail("Only roles with the %s attribute may revoke roles with %s.",
2151+
errdetail("Only roles with the %s attribute may revoke roles with the %s attribute.",
21522152
"SUPERUSER", "SUPERUSER")));
21532153
}
21542154
}

src/backend/storage/ipc/signalfuncs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ pg_cancel_backend(PG_FUNCTION_ARGS)
122122
ereport(ERROR,
123123
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
124124
errmsg("permission denied to cancel query"),
125-
errdetail("Only roles with the %s attribute may cancel queries of roles with %s.",
125+
errdetail("Only roles with the %s attribute may cancel queries of roles with the %s attribute.",
126126
"SUPERUSER", "SUPERUSER")));
127127

128128
if (r == SIGNAL_BACKEND_NOPERMISSION)
@@ -228,7 +228,7 @@ pg_terminate_backend(PG_FUNCTION_ARGS)
228228
ereport(ERROR,
229229
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
230230
errmsg("permission denied to terminate process"),
231-
errdetail("Only roles with the %s attribute may terminate processes of roles with %s.",
231+
errdetail("Only roles with the %s attribute may terminate processes of roles with the %s attribute.",
232232
"SUPERUSER", "SUPERUSER")));
233233

234234
if (r == SIGNAL_BACKEND_NOPERMISSION)

src/backend/utils/init/postinit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ InitPostgres(const char *in_dbname, Oid dboid,
946946
if (nfree < SuperuserReservedConnections)
947947
ereport(FATAL,
948948
(errcode(ERRCODE_TOO_MANY_CONNECTIONS),
949-
errmsg("remaining connection slots are reserved for roles with %s",
949+
errmsg("remaining connection slots are reserved for roles with the %s attribute",
950950
"SUPERUSER")));
951951

952952
if (!has_privs_of_role(GetUserId(), ROLE_PG_USE_RESERVED_CONNECTIONS))

src/test/regress/expected/create_role.out

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ CREATE ROLE regress_role_normal;
88
SET SESSION AUTHORIZATION regress_role_limited_admin;
99
CREATE ROLE regress_nosuch_superuser SUPERUSER;
1010
ERROR: permission denied to create role
11-
DETAIL: Only roles with the SUPERUSER attribute may create roles with SUPERUSER.
11+
DETAIL: Only roles with the SUPERUSER attribute may create roles with the SUPERUSER attribute.
1212
CREATE ROLE regress_nosuch_replication_bypassrls REPLICATION BYPASSRLS;
1313
ERROR: permission denied to create role
14-
DETAIL: Only roles with the REPLICATION attribute may create roles with REPLICATION.
14+
DETAIL: Only roles with the REPLICATION attribute may create roles with the REPLICATION attribute.
1515
CREATE ROLE regress_nosuch_replication REPLICATION;
1616
ERROR: permission denied to create role
17-
DETAIL: Only roles with the REPLICATION attribute may create roles with REPLICATION.
17+
DETAIL: Only roles with the REPLICATION attribute may create roles with the REPLICATION attribute.
1818
CREATE ROLE regress_nosuch_bypassrls BYPASSRLS;
1919
ERROR: permission denied to create role
20-
DETAIL: Only roles with the BYPASSRLS attribute may create roles with BYPASSRLS.
20+
DETAIL: Only roles with the BYPASSRLS attribute may create roles with the BYPASSRLS attribute.
2121
CREATE ROLE regress_nosuch_createdb CREATEDB;
2222
ERROR: permission denied to create role
23-
DETAIL: Only roles with the CREATEDB attribute may create roles with CREATEDB.
23+
DETAIL: Only roles with the CREATEDB attribute may create roles with the CREATEDB attribute.
2424
-- ok, can create a role without any special attributes
2525
CREATE ROLE regress_role_limited;
2626
-- fail, can't give it in any of the restricted attributes
@@ -71,7 +71,7 @@ NOTICE: SYSID can no longer be specified
7171
-- fail, cannot grant membership in superuser role
7272
CREATE ROLE regress_nosuch_super IN ROLE regress_role_super;
7373
ERROR: permission denied to grant role "regress_role_super"
74-
DETAIL: Only roles with the SUPERUSER attribute may grant roles with SUPERUSER.
74+
DETAIL: Only roles with the SUPERUSER attribute may grant roles with the SUPERUSER attribute.
7575
-- fail, database owner cannot have members
7676
CREATE ROLE regress_nosuch_dbowner IN ROLE pg_database_owner;
7777
ERROR: role "pg_database_owner" cannot have explicit members
@@ -238,7 +238,7 @@ DROP ROLE regress_adminroles;
238238
-- fail, cannot drop ourself, nor superusers or roles we lack ADMIN for
239239
DROP ROLE regress_role_super;
240240
ERROR: permission denied to drop role
241-
DETAIL: Only roles with the SUPERUSER attribute may drop roles with SUPERUSER.
241+
DETAIL: Only roles with the SUPERUSER attribute may drop roles with the SUPERUSER attribute.
242242
DROP ROLE regress_role_admin;
243243
ERROR: current user cannot be dropped
244244
DROP ROLE regress_rolecreator;

0 commit comments

Comments
 (0)