patch: disable bypass of expand variadic for "ANY" variable function, format_array function for formatting with params in array - Mailing list pgsql-hackers

From Pavel Stehule
Subject patch: disable bypass of expand variadic for "ANY" variable function, format_array function for formatting with params in array
Date
Msg-id CAFj8pRA=pxgai=hCospRYmWc_P0M0DPmvsX=JN3vYUqVGfAsAw@mail.gmail.com
Whole thread Raw
Responses Re: patch: disable bypass of expand variadic for "ANY" variable function, format_array function for formatting with params in array
List 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

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: build farm machine using mixed results
Next
From: Tom Lane
Date:
Subject: Re: patch: disable bypass of expand variadic for "ANY" variable function, format_array function for formatting with params in array