Re: 9.5 BLOCKER: regrole and regnamespace and quotes

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: 9.5 BLOCKER: regrole and regnamespace and quotes
Дата
Msg-id 27160.1451877814@sss.pgh.pa.us
обсуждение исходный текст
Ответ на 9.5 BLOCKER: regrole and regnamespace and quotes  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Ответы Re: 9.5 BLOCKER: regrole and regnamespace and quotes  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Re: 9.5 BLOCKER: regrole and regnamespace and quotes  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Список pgsql-hackers
Jim Nasby <Jim.Nasby@BlueTreble.com> writes:
> regrole and regnamespace don't run their output through quote_ident(). 
> That's contrary to all the other reg* operators.
> Worse, they also don't *allow* quoted input. Not only is that different 
> from reg*, it's the *opposite*:

BTW, there's a concrete reason why this is broken, which is that although
regrole and regnamespace didn't bother with copying quoting/dequoting from
the other types, they *did* copy the special case logic about allowing
and emitting numeric OIDs.  This means that an output like "1234" from
regroleout is formally inconsistent: there is no way to tell if it's an
numeric OID or a role name that happens to be all digits.  (With proper
quoting logic, you could tell because an all-digits role name would have
gotten quoted.)  Conversely, if you create an all-digits role name, there
is no way to get regrolein to interpret it as such, whereas a dequoting
rule would have disambiguated.

I'm inclined to leave to_regrole and to_regnamespace alone, though, since
they have no numeric-OID path, and they will provide an "out" for anyone
who wants to handle nonquoted names.  (Though at least in HEAD we ought to
fix them to take type text as input.  Using cstring for ordinary functions
is just sloppy.)
        regards, tom lane



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

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: Broken lock management in policy.c.
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: 9.5 BLOCKER: regrole and regnamespace and quotes