Re: 9.5 BLOCKER: regrole and regnamespace and quotes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: 9.5 BLOCKER: regrole and regnamespace and quotes
Date: 2016-01-04 03:23:34
Message-ID: 27160.1451877814@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2016-01-04 03:29:58 Re: 9.5 BLOCKER: regrole and regnamespace and quotes
Previous Message Peter Geoghegan 2016-01-04 03:01:18 Re: Broken lock management in policy.c.