Re: Strict functions with variadic "any" argument bug
| От | Tom Lane |
|---|---|
| Тема | Re: Strict functions with variadic "any" argument bug |
| Дата | |
| Msg-id | 2382304.1765054079@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Strict functions with variadic "any" argument bug (Svetlana Derevyanko <s.derevyanko@postgrespro.ru>) |
| Список | pgsql-hackers |
Svetlana Derevyanko <s.derevyanko@postgrespro.ru> writes:
> A few days ago Karina Litskevich noticed that strict function with
> variadic argument containing a few values, only one of which was NULL,
> returned NULL without evaluating the function itself. It didn't match
> with documented behaviour:
> "If a function is declared STRICT with a VARIADIC argument, the
> strictness check tests that the variadic array as a whole is non-null.
> The function will still be called if the array has null elements."
> After some digging it turned out that since VARIADIC "any" argument
> contents are not (can not?) transformed into single array (due to being
> possibly of different types), the corresponding parameters are checked
> in evaluate_function individually.
Yeah. I don't think this is actually a bug, and I don't agree with
trying to make it work. Since variadic-ANY isn't implemented with
an array, the documentation fragment you quote isn't very on-point.
The actual implementation is that all arguments are checked
individually, and if you change that what is likely to happen is
crashes of variadic-ANY functions that aren't expecting nulls.
If the function author wants to handle nulls, the function should
be marked not-strict.
The documentation about this could use some work, perhaps.
regards, tom lane
В списке pgsql-hackers по дате отправления: