@@ -2425,6 +2425,22 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname
24252425 </para>
24262426 </listitem>
24272427 </varlistentry>
2428+
2429+ <varlistentry id="libpq-connect-report-parameters" xreflabel="report_parameters">
2430+ <term><literal>report_parameters</literal></term>
2431+ <listitem>
2432+ <para>
2433+ Specifies the value that is requested at connection startup for the
2434+ <xref linkend="protocol-parameter-report-parameters"/> protocol
2435+ parameter. The connection attempt is not canceled if the server does
2436+ not support this protocol parameter, or if it only supports part of
2437+ the requested value.
2438+ Use the <xref linkend="libpq-PQreportParameters"/> function after
2439+ connection has completed to find out what actual value the server uses.
2440+ </para>
2441+
2442+ </listitem>
2443+ </varlistentry>
24282444 </variablelist>
24292445 </para>
24302446 </sect2>
@@ -2742,7 +2758,7 @@ const char *PQparameterStatus(const PGconn *conn, const char *paramName);
27422758 </para>
27432759
27442760 <para>
2745- Parameters reported as of the current release include:
2761+ The parameters that are reported by default as of the current release include:
27462762 <simplelist type="vert" columns="2">
27472763 <member><varname>application_name</varname></member>
27482764 <member><varname>client_encoding</varname></member>
@@ -2770,6 +2786,10 @@ const char *PQparameterStatus(const PGconn *conn, const char *paramName);
27702786 <varname>server_encoding</varname> and
27712787 <varname>integer_datetimes</varname>
27722788 cannot change after startup.
2789+ It's possible to choose additional parameters for which the values should
2790+ be reported by using the
2791+ <xref linkend="protocol-parameter-report-parameters"/> protocol
2792+ parameter.
27732793 </para>
27742794
27752795 <para>
@@ -7707,6 +7727,117 @@ PGContextVisibility PQsetErrorContextVisibility(PGconn *conn, PGContextVisibilit
77077727 </listitem>
77087728 </varlistentry>
77097729
7730+ <varlistentry id="libpq-PQreportParameters">
7731+ <term><function>PQreportParameters</function><indexterm><primary>PQreportParameter</primary></indexterm></term>
7732+
7733+ <listitem>
7734+ <para>
7735+ Returns the server value of the
7736+ <xref linkend="protocol-parameter-report-parameters"/> protocol parameter.
7737+ <synopsis>
7738+ const char *PQreportParameters(const PGconn *<replaceable>conn</replaceable>);
7739+ </synopsis>
7740+
7741+ This returns a string with a comma separated list of server parameter
7742+ names. If the protocol parameter is not supported by the server this
7743+ returns NULL instead. Checking this value for NULL is the recommended way
7744+ to check for server support of report_parameters.
7745+ </para>
7746+ </listitem>
7747+ </varlistentry>
7748+
7749+ <varlistentry id="libpq-PQreportParametersSupport">
7750+ <term><function>PQreportParametersSupport</function><indexterm><primary>PQreportParametersSupport</primary></indexterm></term>
7751+
7752+ <listitem>
7753+ <para>
7754+ Returns the "supported values" of the
7755+ <xref linkend="protocol-parameter-report-parameters"/> protocol parameter.
7756+ <synopsis>
7757+ const char *PQreportParametersSupport(const PGconn *<replaceable>conn</replaceable>);
7758+ </synopsis>
7759+
7760+ This returns a string indicating what features report_parameters supports,
7761+ on future protocol versions this might be more useful, but for now this
7762+ always returns '<literal>L</literal>' if the report_parameters protocol
7763+ parameter is supported by the server. If the protocol parameter is not
7764+ supported by the server this returns NULL instead.
7765+ </para>
7766+ </listitem>
7767+ </varlistentry>
7768+
7769+ <varlistentry id="libpq-PQsetReportParameters">
7770+ <term><function>PQsetReportParameters</function><indexterm><primary>PQsetReportParameters</primary></indexterm></term>
7771+
7772+ <listitem>
7773+ <para>
7774+ Sends a request to set the value of the
7775+ <xref linkend="protocol-parameter-report-parameters"/> protocol parameter.
7776+ <synopsis>
7777+ PGresult *PQsetReportParameters(PGconn *<replaceable>conn</replaceable>, const char *<replaceable>params</replaceable>);
7778+ </synopsis>
7779+
7780+ <replaceable>conn</replaceable> is a connection to the server,
7781+ and <replaceable>params</replaceable> is a comma separated list of
7782+ parameter names for which the server should report their values.
7783+ use. If the request was not even sent, the function returns NULL;
7784+ The error message can be retrieved using
7785+ <xref linkend="libpq-PQerrorMessage"/>.
7786+ </para>
7787+
7788+ <para>
7789+ Returns a <structname>PGresult</structname> pointer representing the
7790+ result of the command, or a null pointer if the routine failed before
7791+ issuing any command.
7792+ The <xref linkend="libpq-PQresultStatus"/> function should be called
7793+ to check the return value for any errors (including the value of a null
7794+ pointer, in which case it will return
7795+ <symbol>PGRES_FATAL_ERROR</symbol>). Use
7796+ <xref linkend="libpq-PQerrorMessage"/> to get more information about
7797+ such errors.
7798+ </para>
7799+
7800+ <para>
7801+ The status can be <literal>PGRES_COMMAND_OK</literal> if the command
7802+ succeeded, <literal>PGRES_FATAL_ERROR</literal> if it failed, or
7803+ <literal>PGRES_NONFATAL_ERROR</literal> if it failed but not in a way
7804+ that required aborting a running transaction. Use
7805+ <xref linkend="libpq-PQerrorMessage"/> to get more information about the
7806+ error when the status is <literal>PGRES_FATAL_ERROR</literal>.
7807+ </para>
7808+
7809+ <para>
7810+ In case of success, use <xref linkend="libpq-PQreportParameters"/> to
7811+ find the new value of the report_parameters protocol parameter. This new
7812+ value might be different than the value that was sent, due to e.g.
7813+ unknown parameters.
7814+ </para>
7815+ </listitem>
7816+ </varlistentry>
7817+
7818+ <varlistentry id="libpq-PQsendSetReportParameters">
7819+ <term><function>PQsendSetReportParameters</function><indexterm><primary>PQsendSetReportParameters</primary></indexterm></term>
7820+
7821+ <listitem>
7822+ <para>
7823+ Sends a request to set the value of the
7824+ <xref linkend="protocol-parameter-report-parameters"/> protocol
7825+ parameter, without waiting for completion.
7826+ <synopsis>
7827+ int PQsendSetReportParameters(PGconn *conn, const char *params);
7828+ </synopsis>
7829+
7830+ This is an asynchronous version of
7831+ <xref linkend="libpq-PQsetReportParameters"/>: it
7832+ returns 1 if it was able to dispatch the request, and 0 if not.
7833+ After a successful call, call <xref linkend="libpq-PQgetResult"/> to
7834+ determine whether the server successfully set report_parameters. The
7835+ function's parameters are handled identically to
7836+ <xref linkend="libpq-PQsetReportParameters"/>.
7837+ </para>
7838+ </listitem>
7839+ </varlistentry>
7840+
77107841 <varlistentry id="libpq-PQtrace">
77117842 <term><function>PQtrace</function><indexterm><primary>PQtrace</primary></indexterm></term>
77127843
0 commit comments