patch: disable bypass of expand variadic for "ANY" variable function, format_array function for formatting with params in array

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема patch: disable bypass of expand variadic for "ANY" variable function, format_array function for formatting with params in array
Дата
Msg-id CAFj8pRA=pxgai=hCospRYmWc_P0M0DPmvsX=JN3vYUqVGfAsAw@mail.gmail.com
обсуждение исходный текст
Ответы Re: patch: disable bypass of expand variadic for "ANY" variable function, format_array function for formatting with params in array  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hello

This patch disable bypassing of parameters for variadic function with
"ANY" type variadic parameter. Now - this functionality is just
broken. Because there are no any requests for fixing this issue, I
propose the most simply solution - just disable using this type of
variadic function when variadic variables are not expanded. Internally
it has impact to "format" function only. There are no possibility put
parameters in array. But this possibility can be useful. I cannot to
use overloading due ambiguous functions with "any" and "anyarray"
params. Solution can be new function "format_array" - that share code
with "format" function.

postgres=# select format_array('Hello %s, %1$s', array['World']);
    format_array
--------------------
 Hello World, World
(1 row)

postgres=# select format('Hello %s, %1$s', variadic array['World']);
ERROR:  function format(unknown, text[]) does not exist
LINE 1: select format('Hello %s, %1$s', variadic array['World']);
               ^
HINT:  No function matches the given name and argument types. You
might need to add explicit type casts.
postgres=# select format('Hello %s, %1$s', 'World');
       format
--------------------
 Hello World, World
(1 row)

Regards

Pavel Stehule

Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: build farm machine using mixed results
Следующее
От: Tom Lane
Дата:
Сообщение: Re: patch: disable bypass of expand variadic for "ANY" variable function, format_array function for formatting with params in array