Re: alter user/role CURRENT_USER - Mailing list pgsql-hackers

From Kyotaro HORIGUCHI
Subject Re: alter user/role CURRENT_USER
Date
Msg-id 20141105.171958.22686614.horiguchi.kyotaro@lab.ntt.co.jp
Whole thread Raw
In response to Re: alter user/role CURRENT_USER  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: alter user/role CURRENT_USER  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
List pgsql-hackers
Hello,

> Adam Brightwell <adam.brightwell@crunchydatasolutions.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_USERand 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
nameto  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




pgsql-hackers by date:

Previous
From: Anssi Kääriäinen
Date:
Subject: Re: tracking commit timestamps
Next
From: Heikki Linnakangas
Date:
Subject: Re: WAL format and API changes (9.5)