mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Reserve the "pg_" namespace for roles
This will prevent users from creating roles which begin with "pg_" and will check for those roles before allowing an upgrade using pg_upgrade. This will allow for default roles to be provided at initdb time. Reviews by José Luis Tallón and Robert Haas
This commit is contained in:
@ -78,6 +78,18 @@ CREATE ROLE "none"; -- error
|
||||
ERROR: role name "none" is reserved
|
||||
LINE 1: CREATE ROLE "none";
|
||||
^
|
||||
CREATE ROLE pg_abc; -- error
|
||||
ERROR: role name "pg_abc" is reserved
|
||||
DETAIL: Role names starting with "pg_" are reserved.
|
||||
CREATE ROLE "pg_abc"; -- error
|
||||
ERROR: role name "pg_abc" is reserved
|
||||
DETAIL: Role names starting with "pg_" are reserved.
|
||||
CREATE ROLE pg_abcdef; -- error
|
||||
ERROR: role name "pg_abcdef" is reserved
|
||||
DETAIL: Role names starting with "pg_" are reserved.
|
||||
CREATE ROLE "pg_abcdef"; -- error
|
||||
ERROR: role name "pg_abcdef" is reserved
|
||||
DETAIL: Role names starting with "pg_" are reserved.
|
||||
CREATE ROLE testrol0 SUPERUSER LOGIN;
|
||||
CREATE ROLE testrolx SUPERUSER LOGIN;
|
||||
CREATE ROLE testrol2 SUPERUSER;
|
||||
@ -804,6 +816,14 @@ LINE 1: DROP USER MAPPING IF EXISTS FOR CURRENT_ROLE SERVER sv9;
|
||||
DROP USER MAPPING IF EXISTS FOR nonexistent SERVER sv9; -- error
|
||||
NOTICE: role "nonexistent" does not exist, skipping
|
||||
-- GRANT/REVOKE
|
||||
GRANT testrol0 TO pg_abc; -- error
|
||||
ERROR: role "pg_abc" is reserved
|
||||
DETAIL: Cannot GRANT roles to a reserved role.
|
||||
GRANT pg_abc TO pg_abcdef; -- error
|
||||
ERROR: role "pg_abcdef" is reserved
|
||||
DETAIL: Cannot GRANT roles to a reserved role.
|
||||
SET ROLE pg_testrole; -- error
|
||||
ERROR: invalid value for parameter "role": "pg_testrole"
|
||||
UPDATE pg_proc SET proacl = null WHERE proname LIKE 'testagg_';
|
||||
SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_';
|
||||
proname | proacl
|
||||
|
@ -57,6 +57,11 @@ CREATE ROLE "public"; -- error
|
||||
CREATE ROLE none; -- error
|
||||
CREATE ROLE "none"; -- error
|
||||
|
||||
CREATE ROLE pg_abc; -- error
|
||||
CREATE ROLE "pg_abc"; -- error
|
||||
CREATE ROLE pg_abcdef; -- error
|
||||
CREATE ROLE "pg_abcdef"; -- error
|
||||
|
||||
CREATE ROLE testrol0 SUPERUSER LOGIN;
|
||||
CREATE ROLE testrolx SUPERUSER LOGIN;
|
||||
CREATE ROLE testrol2 SUPERUSER;
|
||||
@ -376,6 +381,11 @@ DROP USER MAPPING IF EXISTS FOR CURRENT_ROLE SERVER sv9; --error
|
||||
DROP USER MAPPING IF EXISTS FOR nonexistent SERVER sv9; -- error
|
||||
|
||||
-- GRANT/REVOKE
|
||||
GRANT testrol0 TO pg_abc; -- error
|
||||
GRANT pg_abc TO pg_abcdef; -- error
|
||||
|
||||
SET ROLE pg_testrole; -- error
|
||||
|
||||
UPDATE pg_proc SET proacl = null WHERE proname LIKE 'testagg_';
|
||||
SELECT proname, proacl FROM pg_proc WHERE proname LIKE 'testagg_';
|
||||
|
||||
|
Reference in New Issue
Block a user