aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-04-30 15:10:06 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2021-04-30 15:10:06 -0400
commit386e64ea5abf346d887c21ea8869317838ba19b5 (patch)
treebe6243a6229f73b69e0167d3fa9e0eb65f3affbf
parent2efcd502e56a528f75ec8e88c02a287ad3457d77 (diff)
downloadpostgresql-386e64ea5abf346d887c21ea8869317838ba19b5.tar.gz
postgresql-386e64ea5abf346d887c21ea8869317838ba19b5.zip
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
-rw-r--r--doc/src/sgml/libpq.sgml23
1 files changed, 20 insertions, 3 deletions
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index 174a6b7f37b..875950b83c0 100644
--- a/doc/src/sgml/libpq.sgml
+++ b/doc/src/sgml/libpq.sgml
@@ -5760,15 +5760,32 @@ typedef struct
<para>
<function>PQfn</function> always returns a valid
- <structname>PGresult</structname> pointer. The result status should be
+ <structname>PGresult</structname> pointer, with
+ status <literal>PGRES_COMMAND_OK</literal> for success
+ or <literal>PGRES_FATAL_ERROR</literal> if some problem was encountered.
+ The result status should be
checked before the result is used. The caller is responsible for
freeing the <structname>PGresult</structname> with
<xref linkend="libpq-PQclear"/> when it is no longer needed.
</para>
<para>
- Note that it is not possible to handle null arguments, null results,
- nor set-valued results when using this interface.
+ To pass a NULL argument to the function, set
+ the <parameter>len</parameter> field of that parameter structure
+ to <literal>-1</literal>; the <parameter>isint</parameter>
+ and <parameter>u</parameter> fields are then irrelevant.
+ </para>
+
+ <para>
+ If the function returns NULL, <parameter>*result_len</parameter> is set
+ to <literal>-1</literal>, and <parameter>*result_buf</parameter> is not
+ modified.
+ </para>
+
+ <para>
+ Note that it is not possible to handle set-valued results when using
+ this interface. Also, the function must be a plain function, not an
+ aggregate, window function, or procedure.
</para>
</sect1>