Re: 9.5 BLOCKER: regrole and regnamespace and quotes
От | Jim Nasby |
---|---|
Тема | Re: 9.5 BLOCKER: regrole and regnamespace and quotes |
Дата | |
Msg-id | 5689E736.9020606@BlueTreble.com обсуждение исходный текст |
Ответ на | Re: 9.5 BLOCKER: regrole and regnamespace and quotes (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: 9.5 BLOCKER: regrole and regnamespace and quotes
|
Список | pgsql-hackers |
On 1/3/16 9:23 PM, Tom Lane wrote: > 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.) 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
Вложения
В списке pgsql-hackers по дате отправления: