Re: Valid role name (PostgreSQL 9.0.4)

Поиск
Список
Период
Сортировка
От Grzegorz Szpetkowski
Тема Re: Valid role name (PostgreSQL 9.0.4)
Дата
Msg-id BANLkTi=jQ739XzuAQ_yMWpm4Kq4z7dMLvA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Valid role name (PostgreSQL 9.0.4)  (Josh Kupershmidt <schmiddy@gmail.com>)
Ответы Re: Valid role name (PostgreSQL 9.0.4)  (Josh Kupershmidt <schmiddy@gmail.com>)
Список pgsql-novice
You are right. I found in documentation:

"As a general rule, if you get spurious parser errors for commands
that contain any of the listed key words as an identifier you should
try to quote the identifier to see if the problem goes away."

psql -c ALTER ROLE "user" CREATEDB'

On the other hand there is also:

"According to the standard, reserved key words are the only real key
words; they are never allowed as identifiers."

Since USER is reserved PostgreSQL keywords should I generally avoid
such names ? I found that I can even create (distinct) "USER" role:

createuser -SdR USER
psql -c "\du"
                       List of roles
 Role name |            Attributes             | Member of
-----------+-----------------------------------+-----------
 USER      | Create DB                         | {}
 postgres  | Superuser, Create role, Create DB | {}
 user      | Create DB                         | {}

Regards,
Grzegorz Sz.

2011/4/8 Josh Kupershmidt <schmiddy@gmail.com>:
> On Thu, Apr 7, 2011 at 11:21 PM, Grzegorz Szpetkowski
> <gszpetkowski@gmail.com> wrote:
>> Then I run:
>>
>> psql -c "ALTER ROLE user CREATEDB"
>> ERROR:  syntax error at or near "user"
>> LINE 1: ALTER ROLE user CREATEDB
>>                  ^
>
> If you quote the "user" username like so:
>
> ALTER ROLE "user" CREATEDB;
>
> the command should work as you expected it to.
>
> Josh
>

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

Предыдущее
От: Grzegorz Szpetkowski
Дата:
Сообщение: Re: Superuser accout (PostgreSQL 9.0.4)
Следующее
От: Josh Kupershmidt
Дата:
Сообщение: Re: Valid role name (PostgreSQL 9.0.4)