Re: [HACKERS] allow referring to functions without arguments whenunique

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: [HACKERS] allow referring to functions without arguments whenunique
Дата
Msg-id 565c3261-09bf-7feb-2658-b0802466b059@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: [HACKERS] allow referring to functions without arguments when unique  (Michael Paquier <michael.paquier@gmail.com>)
Ответы Re: [HACKERS] allow referring to functions without arguments when unique  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-hackers
On 3/7/17 00:32, Michael Paquier wrote:
>> OK. After a lookup, I am just seeing opfamily, opclass missing, so
>> this patch is doing it as you describe.

I'm not sure what you mean here.

>> @@ -7198,6 +7198,33 @@ function_with_argtypes:
>>                     n->objargs = extractArgTypes($2);
>>                     $$ = n;
>>                 }
>> This may not have arguments listed, so is function_with_argtypes really adapted?

Well, we could do something like function_with_opt_argtypes?

>> +   /*
>> +    * If no arguments were specified, the name must yield a unique candidate.
>> +    */
>> +   if (nargs == -1 && clist)
>> +   {
>> +       if (clist->next)
>> +           ereport(ERROR,
>> I would have used list_length here for clarity.

This is actually not a "List" node.

>> The comment at the top of LookupFuncName() needs a refresh. The caller
>> can as well just use a function name without arguments.

Fixed.

> =# set search_path to 'public,popo';

I think you mean

set search_path to public,popo;

> =# drop function dup2;
> ERROR:  42883: function dup2() does not exist
> LOCATION:  LookupFuncName, parse_func.c:1944
> In this case I would have expected an error telling that the name is
> ambiguous. FuncnameGetCandidates() returns an empty list.

Your example works correctly if you set the schema path correctly.
However, the error message is misleading with the parentheses.  I have
updated that to create a different error message for this case, and
added a test case.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Вложения

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

Предыдущее
От: Petr Jelinek
Дата:
Сообщение: [HACKERS] Logical replication origin tracking fix
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] [PATCH] Enabling atomics on ARM64