From: | Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> |
---|---|
To: | adam(dot)brightwell(at)crunchydatasolutions(dot)com |
Cc: | rushabh(dot)lathia(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: alter user/role CURRENT_USER |
Date: | 2014-10-24 08:29:28 |
Message-ID: | 20141024.172928.175497798.horiguchi.kyotaro@lab.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi, here is the revised patch.
Attached files are the followings
- 0001-ALTER-ROLE-CURRENT_USER_v2.patch - the patch.
- testset.tar.bz2 - test set. Run by typing 'make check' as a
superuser of the running postgreSQL server. It creates "testdb"
and some roles.
Documents are not edited this time.
----
Considering your comments, I found more points to modify.
- CREATE SCHEMA (IF NOT EXISTS) .. AUTHORIZATION <role> ...
- ALTER AGGREAGE/COLLATION/etc... OWNER TO <role>
- CREATE/ALTER/DROP USER MAPPING FOR <role> SERVER ..
GRANT/REVOKE also takes role as an arguemnt but CURRENT_USER and
the similar keywords seem to be useless for them.
Finally, the new patch modifies the following points.
In gram.y,
- RoleId's are replaced with RoleId_or_curruser in more places.
It accepts CURRENT_USER/USER/CURRENT_ROLE/SESSION_USER.
- ALTER USER ALL syntax is added. (not changed from the previous patch)
- The non-terminal auth_ident now uses RoleId_or_curruser
instead of RoleId. This affects CREATE/ALTER/DROP USER MAPPING
In user.c, new function ResolveRoleId() is added and used for all
role ID resolutions that correspond to the syntax changes in
parser. It is AlterRole() in user.c.
In foreigncmds.c, GetUserOidFromMapping() is removed and
ResolveRoleId is used instead.
In alter.c and tablecmds.c, all calls to get_role_oid()
correspond the the grammer change were replaced with
ResolveRoleId().
The modifications are a bit complicated so I provided a
comprehensive test set.
regards,
--
Kyotaro Horiguchi
NTT Open Source Software Center
Attachment | Content-Type | Size |
---|---|---|
0001-ALTER-ROLE-CURRENT_USER_v2.patch | text/x-patch | 18.7 KB |
testset.tar.bz2 | application/octet-stream | 3.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2014-10-24 08:36:02 | Re: make pg_controldata accept "-D dirname" |
Previous Message | Ali Akbar | 2014-10-24 08:24:03 | Re: Function array_agg(array) |