Re: alter user/role CURRENT_USER

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: sfrost(at)snowman(dot)net
Cc: kgrittn(at)ymail(dot)com, adam(dot)brightwell(at)crunchydatasolutions(dot)com, marti(at)juffo(dot)org, rushabh(dot)lathia(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: alter user/role CURRENT_USER
Date: 2014-10-29 08:47:39
Message-ID: 20141029.174739.199648648.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello, thank you all for many comments.

At the first, I removed changes for role-vs-user consistency and
remove all added role named other than current_user.

The followings are one-by-one answer for the comments so far,
please let me know if I missed anything.

- The necessity of the new function ResolveRoleId()

It is very brief function but used in many place where the role
name should be treated in the same way, so I think encapsulation
is needed in some extent and in any form. It could be merged
with get_role_oid.

- About changes in foreigncmds.c

I removed the refactoring using ResolveRoleId() in this patch.

- RoleId_or_curruser separate from RoleId.

There seems to be places where 'current_user' and like is not
appropraite to occur such as CREATE USER. I don't mind to remove
the non-terminal if it is needless consideration.

- GRANT is not modified.

I thought GRANT is not appropriate but it seems appropriate
seeing your example. And grantee takes "public". I changed
GRANT/REVOKE to take current_user in this patch.

- (not a comment) CREATE SCHEMA needed additonal aid

Schema name can be omitted in CREATE SCHEMA and role name is
used for it, so "CREATE SCHEMA AUTHORIZATION current_user"
crates the schema "current_user" in the previous patch. This
should be the real name of current_user.

This patch is for reviewing at a glance for food of discussion
and tested very briefly (and what is worse, it might even not be
applicable). I'll repost more refined version in this way and
other portions.

At Tue, 28 Oct 2014 12:16:13 -0400, Stephen Frost <sfrost(at)snowman(dot)net> wrote in <20141028161613(dot)GT28859(at)tamriel(dot)snowman(dot)net>
> * Kevin Grittner (kgrittn(at)ymail(dot)com) wrote:
> > It is very important that a quoted identifier not be treated as a
> > keyword. I would be very interested in seeing that list, and in
> > ensuring that it doesn't get any longer.
>
> It's object specific and not handled through the grammar, so that gets
> pretty annoying. :/
>
> The ones I could find by a quick look through backend/commands are:
>
> roles
> public
> none
>
> schemas
> pg_*
>
> operator
> => (throws a warning at least)
>
> There may be other cases that my quick review didn't find, of course.

Hmm... This seems to be another issue, though. I'll be careful
not to make it worse..

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
0001-CURRENT_USER_WIP_v1.patch text/x-patch 17.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2014-10-29 08:48:51 Re: group locking: incomplete patch, just for discussion
Previous Message Heikki Linnakangas 2014-10-29 08:24:20 Re: WAL format and API changes (9.5)