Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 386e64e

Browse files
committed
Doc: update libpq's documentation for PQfn().
Mention specifically that you can't call aggregates, window functions, or procedures this way (the inability to call SRFs was already mentioned). Also, the claim that PQfn doesn't support NULL arguments or results has been a lie since we invented protocol 3.0. Not sure why this text was never updated for that, but do it now. Discussion: https://postgr.es/m/2039442.1615317309@sss.pgh.pa.us
1 parent 2efcd50 commit 386e64e

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

doc/src/sgml/libpq.sgml

+20-3
Original file line numberDiff line numberDiff line change
@@ -5760,15 +5760,32 @@ typedef struct
57605760

57615761
<para>
57625762
<function>PQfn</function> always returns a valid
5763-
<structname>PGresult</structname> pointer. The result status should be
5763+
<structname>PGresult</structname> pointer, with
5764+
status <literal>PGRES_COMMAND_OK</literal> for success
5765+
or <literal>PGRES_FATAL_ERROR</literal> if some problem was encountered.
5766+
The result status should be
57645767
checked before the result is used. The caller is responsible for
57655768
freeing the <structname>PGresult</structname> with
57665769
<xref linkend="libpq-PQclear"/> when it is no longer needed.
57675770
</para>
57685771

57695772
<para>
5770-
Note that it is not possible to handle null arguments, null results,
5771-
nor set-valued results when using this interface.
5773+
To pass a NULL argument to the function, set
5774+
the <parameter>len</parameter> field of that parameter structure
5775+
to <literal>-1</literal>; the <parameter>isint</parameter>
5776+
and <parameter>u</parameter> fields are then irrelevant.
5777+
</para>
5778+
5779+
<para>
5780+
If the function returns NULL, <parameter>*result_len</parameter> is set
5781+
to <literal>-1</literal>, and <parameter>*result_buf</parameter> is not
5782+
modified.
5783+
</para>
5784+
5785+
<para>
5786+
Note that it is not possible to handle set-valued results when using
5787+
this interface. Also, the function must be a plain function, not an
5788+
aggregate, window function, or procedure.
57725789
</para>
57735790

57745791
</sect1>

0 commit comments

Comments
 (0)