Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3c6fd1f

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 arrayto a variadic parameter position. This was already implicit in the textbut it seems better to spell it out.Per a suggestion from David Johnston, though I didn't use his proposedwording. Back-patch to all supported branches.
1 parent86b9424 commit3c6fd1f

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)

[8]ページ先頭

©2009-2025 Movatter.jp