From: Tom Lane Date: Sun, 21 Dec 2014 20:30:39 +0000 (-0500) Subject: Docs: clarify treatment of variadic functions with zero variadic arguments. X-Git-Tag: REL9_5_ALPHA1~1018 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=699300a146c04e207a8fdec407538cdf5368fde5;p=postgresql Docs: clarify treatment of variadic functions with zero variadic arguments. Explain that you have to use "VARIADIC ARRAY[]" to pass an empty array to a variadic parameter position. This was already implicit in the text but it seems better to spell it out. Per a suggestion from David Johnston, though I didn't use his proposed wording. Back-patch to all supported branches. --- diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml index d759f3746b..f40504c481 100644 --- a/doc/src/sgml/xfunc.sgml +++ b/doc/src/sgml/xfunc.sgml @@ -754,6 +754,20 @@ SELECT mleast(VARIADIC ARRAY[10, -1, 5, 4.4]); actual argument of a function call. + + Specifying VARIADIC in the call is also the only way to + pass an empty array to a variadic function, for example: + + +SELECT mleast(VARIADIC ARRAY[]::numeric[]); + + + Simply writing SELECT mleast() does not work because a + variadic parameter must match at least one actual argument. + (You could define a second function also named mleast, + with no parameters, if you wanted to allow such calls.) + + The array element parameters generated from a variadic parameter are treated as not having any names of their own. This means it is not