Re: escaped rolenames in pg_has_role

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: escaped rolenames in pg_has_role
Дата
Msg-id 19846.1182870353@sss.pgh.pa.us
обсуждение исходный текст
Ответ на escaped rolenames in pg_has_role  ("Willy-Bas Loos" <willybas@gmail.com>)
Ответы Re: escaped rolenames in pg_has_role
Список pgsql-general
"Willy-Bas Loos" <willybas@gmail.com> writes:
> The problem is that pg_has_role does not recognize the usernames when they
> are escaped by quote_literal or quote_ident.

Don't use quote_ident here.  In fact, I'd say that you appear to have
completely misunderstood the appropriate rules for quoting at all.
If you are passed data that you don't know if it's quoted or not, what
the heck are you supposed to do with it?  A quote in the data might be
real data or quoting, and you have no way to tell the difference.

You need to redesign your function stack to eliminate that ambiguity.
I'd recommend that data items never have quoting, except at the instant
that they get embedded into SQL strings (which this function isn't doing
at all, and so it does not need to quote the name).

            regards, tom lane

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

Предыдущее
От: "Willy-Bas Loos"
Дата:
Сообщение: escaped rolenames in pg_has_role
Следующее
От: Andrew Sullivan
Дата:
Сообщение: Re: how to implement unusual constraint