Re: Extra functionality to createuser

Поиск
Список
Период
Сортировка
От Amit Kapila
Тема Re: Extra functionality to createuser
Дата
Msg-id CAA4eK1JJqpg-um_eMDZoRH18KwP_bXYt7CCJ0Xeb3vkbv_YodA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Extra functionality to createuser  (Christopher Browne <cbbrowne@gmail.com>)
Список pgsql-hackers
On Wed, Nov 20, 2013 at 9:53 PM, Christopher Browne <cbbrowne@gmail.com> wrote:
> Wait, that doesn't work if more than one role is added, as they get
> merged together by the quoting.
>
> A somewhat ugly amount of quoting can be done at the shell level to
> induce double quotes.
>
> $ createuser -g "\"test_rol'e_3\"" usequoted3
>
> I note that similar (with not quite identical behaviour) issues apply
> to the user name.  Perhaps the
> resolution to this is to leave quoting issues to the administrator.
> That simplifies the problem away.

We are already doing something similar for username, refer below line:
printfPQExpBuffer(&sql, "CREATE ROLE %s", fmtId(newuser));

Here fmtId() is doing handling for quotes. Now for new syntax IN ROLE,
the difference is that it can have multiple strings which needs
additional handling. I think some similar handling should be there in
server, pg_dump as well.

> I suspect that the apparatus needed to do a thorough solution (e.g. -
> parse the string, and do something
> "smarter") may be larger than is worth getting into.

I think if it needs some bigger solution then we can leave it by
having small note in documentation, but if it's just a matter of
calling some existing functions or mimic some handling done at other
place, then it is worth trying.

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com



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

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: noob's query
Следующее
От: Tom Lane
Дата:
Сообщение: Re: COPY table FROM STDIN doesn't show count tag