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

Commit 8e9b7c6

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 89768ee commit 8e9b7c6

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

doc/src/sgml/libpq.sgml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5341,15 +5341,35 @@ typedef struct
53415341

53425342
<para>
53435343
<function>PQfn</function> always returns a valid
5344-
<structname>PGresult</structname> pointer. The result status should be
5344+
<structname>PGresult</structname> pointer, with
5345+
status <literal>PGRES_COMMAND_OK</literal> for success
5346+
or <literal>PGRES_FATAL_ERROR</literal> if some problem was encountered.
5347+
The result status should be
53455348
checked before the result is used. The caller is responsible for
53465349
freeing the <structname>PGresult</structname> with
53475350
<function>PQclear</function> when it is no longer needed.
53485351
</para>
53495352

53505353
<para>
5351-
Note that it is not possible to handle null arguments, null results,
5352-
nor set-valued results when using this interface.
5354+
To pass a NULL argument to the function, set
5355+
the <parameter>len</parameter> field of that parameter structure
5356+
to <literal>-1</literal>; the <parameter>isint</parameter>
5357+
and <parameter>u</parameter> fields are then irrelevant.
5358+
(But this works only in protocol 3.0 and later connections.)
5359+
</para>
5360+
5361+
<para>
5362+
If the function returns NULL, <parameter>*result_len</parameter> is set
5363+
to <literal>-1</literal>, and <parameter>*result_buf</parameter> is not
5364+
modified. (This works only in protocol 3.0 and later connections; in
5365+
protocol 2.0, neither <parameter>*result_len</parameter>
5366+
nor <parameter>*result_buf</parameter> are modified.)
5367+
</para>
5368+
5369+
<para>
5370+
Note that it is not possible to handle set-valued results when using
5371+
this interface. Also, the function must be a plain function, not an
5372+
aggregate, window function, or procedure.
53535373
</para>
53545374

53555375
</sect1>

0 commit comments

Comments
 (0)