From: | Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: 9.5 BLOCKER: regrole and regnamespace and quotes |
Date: | 2016-01-04 03:29:58 |
Message-ID: | 5689E736.9020606@BlueTreble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 1/3/16 9:23 PM, Tom Lane wrote:
> 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.)
None of the other to_reg* casts do that though, so this would be
inconsistent.
Another potential problem for regnamespace is that it doesn't allow an
entry for the catalog. I'm not sure what the spec says about that, but
every other function allows dbname.schema.blah (dbname == catalog).
I started working on a fix, but it's currently blowing up in bootstrap
and I haven't been able to figure out why yet:
running bootstrap script ... FATAL: improper qualified name (too many
dotted names): oid_ops
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
Attachment | Content-Type | Size |
---|---|---|
patch.diff | text/plain | 2.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2016-01-04 03:39:26 | Re: row_security GUC does not behave as documented |
Previous Message | Tom Lane | 2016-01-04 03:23:34 | Re: 9.5 BLOCKER: regrole and regnamespace and quotes |