Re: Roles - SET ROLE Updated
От | Stephen Frost |
---|---|
Тема | Re: Roles - SET ROLE Updated |
Дата | |
Msg-id | 20050721182427.GB24207@ns.snowman.net обсуждение исходный текст |
Ответ на | Re: Roles - SET ROLE Updated (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Roles - SET ROLE Updated
|
Список | pgsql-patches |
* Tom Lane (tgl@sss.pgh.pa.us) wrote: > After rereading SQL99 4.31, I don't think there is any need to > distinguish CURRENT_USER from CURRENT_ROLE, mainly because our > implementation does not distinguish users from roles at all. CURRENT_USER and CURRENT_ROLE can have different values, as I understand SQL2003, and there are places where one is used instead of the other (such as with the 'grantor' in grants, according to SQL2003 the 'grantor' should be the CURRENT_USER, regardless of if CURRENT_ROLE is set or not). I believe this is a seperate issue from how we implement the accounts themselves (where we don't differentiate between users and roles, which is fine). > (Which I think is good.) So ISTM we should not change GetUserId() > as you propose, but leave it alone and implement SetRole approximately > like SetSessionUserId is implemented, ie, setting a background value > that may sometimes get copied into CurrentUserId. The "stack" aspect > only matters to the extent that SetRoleId has precedence over > SetSessionUserId for determining the outside-a-transaction value of > CurrentUserId. SQL2003 also states that CURRENT_ROLE is NULL initially. I suppose we could implement CURRENT_ROLE as a check to see if CurrentUserId is different from CurrentRoleId and return NULL in that case and then just always use CurrentRoleId (or CurrentUserId, whichever). That would avoid having to change how GetUserId() works though this doesn't seem like a huge change to the patch itself. Do you want me to rework the patch along these lines or are you already working on it? I've been having a bit of computer trouble but I think I could get the patch changed/updated by Monday. Thanks, Stephen
Вложения
В списке pgsql-patches по дате отправления: