summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2014-12-21 15:30:39 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2014-12-21 15:31:09 -0500
commit7ac0aff2b83e88edf5e7dcd4c4b425319d9537d6 (patch)
tree612b36644342c4aa2c6138f153e248a37a4515cc /doc/src
parent306b9918b2dd2fb93ea5a0fb62904a05c73fd87a (diff)
downloadpostgresql-7ac0aff2b83e88edf5e7dcd4c4b425319d9537d6.tar.gz
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.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/xfunc.sgml14
1 files changed, 14 insertions, 0 deletions
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
@@ -755,6 +755,20 @@ SELECT mleast(VARIADIC ARRAY[10, -1, 5, 4.4]);
</para>
<para>
+ Specifying <literal>VARIADIC</> in the call is also the only way to
+ pass an empty array to a variadic function, for example:
+
+<screen>
+SELECT mleast(VARIADIC ARRAY[]::numeric[]);
+</screen>
+
+ Simply writing <literal>SELECT mleast()</> does not work because a
+ variadic parameter must match at least one actual argument.
+ (You could define a second function also named <literal>mleast</>,
+ with no parameters, if you wanted to allow such calls.)
+ </para>
+
+ <para>
The array element parameters generated from a variadic parameter are
treated as not having any names of their own. This means it is not
possible to call a variadic function using named arguments (<xref