Re: alter user/role CURRENT_USER

Поиск
Список
Период
Сортировка
От Marti Raudsepp
Тема Re: alter user/role CURRENT_USER
Дата
Msg-id CABRT9RABDq915iMROxxa7VgQ60Pg7t3D+fGz8pyGC6gBFKraBA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: alter user/role CURRENT_USER  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Ответы Re: alter user/role CURRENT_USER
Re: alter user/role CURRENT_USER
Re: alter user/role CURRENT_USER
Список pgsql-hackers
On Fri, Oct 24, 2014 at 11:29 AM, Kyotaro HORIGUCHI
<horiguchi.kyotaro@lab.ntt.co.jp> wrote:
>  - 0001-ALTER-ROLE-CURRENT_USER_v2.patch  - the patch.

+RoleId:        CURRENT_USER                            { $$ = "current_user";}
+           | USER                                  { $$ = "current_user";}
+           | CURRENT_ROLE                          { $$ = "current_user";}
+           | SESSION_USER                          { $$ = "session_user";}

This is kind of ugly, and it means you can't distinguish between a
CURRENT_USER keyword and a quoted user name "current_user". It's a
legitimate user name, so the behavior of the following now changes:

CREATE ROLE "current_user";
ALTER ROLE "current_user" SET work_mem='10MB';

There ought to be a better way to represent this than using magic string values.

----
>    It accepts CURRENT_USER/USER/CURRENT_ROLE/SESSION_USER.

On a stylistic note, do we really want to support the alternative
spellings of CURRENT_USER, like CURRENT_ROLE and USER? The SQL
standard is well-hated for inventing more keywords than necessary.
There is no precedent for using/allowing these aliases in PostgreSQL
DDL commands, and ALTER USER & ROLE aren't SQL standard anyway. So
maybe we should stick with just accepting one canonical syntax
instead.

I think the word USER may reasonably arise from an editing mistake,
ALTER USER USER does not seem like sane syntax that should be
accepted.

----
From your original email:

> - Modify syntax of ALTER USER so as to be an alias of ALTER ROLE.
>   - Added ALL syntax as user name to ALTER USER.

But should ALTER USER ALL and ALTER ROLE ALL really do the same thing?
A user is a role with the LOGIN option. Every user is a role, but not
every role is a user. I suspect that ambiguity was why ALTER USER ALL
wasn't originally implemented.

Regards,
Marti



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Ali Akbar
Дата:
Сообщение: Re: Function array_agg(array)
Следующее
От: David G Johnston
Дата:
Сообщение: Re: proposal: CREATE DATABASE vs. (partial) CHECKPOINT