Re: alter user/role CURRENT_USER

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: adam(dot)brightwell(at)crunchydatasolutions(dot)com, sfrost(at)snowman(dot)net, 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-11-05 08:19:58
Message-ID: 20141105.171958.22686614.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

> Adam Brightwell <adam(dot)brightwell(at)crunchydatasolutions(dot)com> writes:
> > FWIW, I found the following in the archives:
>
> > http://www.postgresql.org/message-id/15516.1038718413@sss.pgh.pa.us
>
> > Now this is from 2002 and it appears it wasn't necessary to change at the
> > time, but I haven't yet found anything else related (it's a big archive).
> > Though, as I understand it, PUBLIC is now non-reserved as of SQL:2011 which
> > might make a compelling argument to leave it as is?
>
> The current spec does list PUBLIC as a non-reserved keyword, but it also
> says (5.4 "Names and identifiers" syntax rules)
>
> 20) No <authorization identifier> shall specify "PUBLIC".
>
> which, oddly enough, seems to license us to handle "PUBLIC" the way
> we are doing. OTOH, it lists CURRENT_USER as a reserved word, suggesting
> that they don't think the same type of hack should be used for that.
>
> I'd be inclined to leave the grammar as such alone (ie CURRENT_USER is
> a keyword, PUBLIC isn't). Changing that has more downside than upside,
> and we do have justification in the spec for treating the two cases
> differently. However, I agree that we should fix the subsequent
> processing so that "current_user" is not confused with CURRENT_USER.

Sure, maybe.

- PUBLIC should be left as it is, as an supecial identifier
which cannot be used even if quoted under some syntax.

- CURRENT_USER should be a kayword as it is, but we shouldn't
inhibit it from being used as an identifier if
quoted. SESSION_USER and USER should be treated in the same way.

We don't want to use something other than string (prefixed by
zero-byte) as a matter of course:). And resolving the name to
roleid instantly in gram.y is not allowed for the reason shown
upthread.

So it is necessary to add a new member for the struct, say
"int special_role;:... Let me have more sane name for it :(

- USER and CURRENT_ROLE are not needed for the syntax other than
them which already uses them.

I will work on this way. Let me know if something is not acceptable.

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Anssi Kääriäinen 2014-11-05 08:24:24 Re: tracking commit timestamps
Previous Message Antonin Houska 2014-11-05 07:58:31 Re: Convert query plan to sql query