Обсуждение: fixing variadic parameters for type "ANY"

Поиск
Список
Период
Сортировка

fixing variadic parameters for type "ANY"

От
Pavel Stehule
Дата:
Hello

Our customer reported issue with "format" function -
http://archives.postgresql.org/pgsql-bugs/2012-09/msg00011.php.

This issue is related to our implementation of variadic functions -
there are gap in implemented functionality - parameter cannot be
marked as VARIADIC in function call, when variadic parameter is "ANY"
type.

In this case VARIADIC keyword is quietly ignored now, that is bug.

I though about some solution in relation to function format. Sometimes

SELECT format(' a = %s, b = %s', VARIADIC ARRAY[10,20])

can be useful.

But implementation is relative harder - because for type "ANY" we
don't do any magic with parameters - in this case we should to unpack
array and unpacked values should be appended on end of parameter
lists. But it cannot be done, because then function signature cannot
be calculated in analyze time - and it does problems across function
call processing. So I propose enhancing FuncExpr and fmgr_info about
boolean "arrayva" field, that is true, when function should to expand
of variadic parameter by self. Polymorphic functions with "ANY"
parameters should be careful now when it use parameters, so it is not
significant difference to current design.

Regards

Pavel