Re: 9.5 BLOCKER: regrole and regnamespace and quotes

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: 9.5 BLOCKER: regrole and regnamespace and quotes
Дата
Msg-id CAB7nPqQsNW4PrbsXCDOZ8HQNLeRCOc1x_k4LyVLnLorxNTv6QQ@mail.gmail.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
On Mon, Jan 4, 2016 at 1:20 PM, Jim Nasby <Jim.Nasby@bluetreble.com> wrote:
> On 1/3/16 9:43 PM, Tom Lane wrote:
>>
>> Jim Nasby <Jim.Nasby@bluetreble.com> writes:
>>>
>>> On 1/3/16 9:23 PM, Tom Lane wrote:
>>> 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).
>>
>>
>> Meh, these types conform to no spec, so we can make them do what we
>> like.  I see about zero reason to allow a catalog name, it would mostly
>> just confuse people.
>
>
> Ok. Not like CREATE SCHEMA allows that anyway.
>
>>> 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
>>
>>
>> Recommendation: don't muck with DeconstructQualifiedName.  That is called
>> in too many places and we are *not* touching any such API twenty-four
>> hours before release wrap.
>
>
> Yeah, looks like that's what was blowing up.
>
>> There's no real advantage to that anyway, compared with just doing
>> stringToQualifiedNameList and then complaining if its list_length isn't 1.
>
>
> What I went with.

Thanks, this is more or less what I... just did..

+    result = get_namespace_oid(nsp_name, false);
This is incorrect, you should use strVal(linitial(names)) instead.

+    if (list_length(names) > 1)
+        ereport(ERROR,
+                (errcode(ERRCODE_SYNTAX_ERROR),
+            errmsg("improper qualified name (too many dotted names): %s",
+                   NameListToString(names))));
I would just mark that as "Invalid syntax".

A couple of tests in regproc.sql would be a good addition as well.
-- 
Michael



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

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: Additional role attributes && superuser review
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: 9.5 BLOCKER: regrole and regnamespace and quotes