Skip to content

Commit 3c6fd1f

Browse files
committed
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.
1 parent 86b9424 commit 3c6fd1f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

doc/src/sgml/xfunc.sgml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,20 @@ SELECT mleast(VARIADIC ARRAY[10, -1, 5, 4.4]);
705705
actual argument of a function call.
706706
</para>
707707

708+
<para>
709+
Specifying <literal>VARIADIC</> in the call is also the only way to
710+
pass an empty array to a variadic function, for example:
711+
712+
<screen>
713+
SELECT mleast(VARIADIC ARRAY[]::numeric[]);
714+
</screen>
715+
716+
Simply writing <literal>SELECT mleast()</> does not work because a
717+
variadic parameter must match at least one actual argument.
718+
(You could define a second function also named <literal>mleast</>,
719+
with no parameters, if you wanted to allow such calls.)
720+
</para>
721+
708722
<para>
709723
The array element parameters generated from a variadic parameter are
710724
treated as not having any names of their own. This means it is not

0 commit comments

Comments
 (0)