diff options
author | Robert Haas <rhaas@postgresql.org> | 2024-09-09 11:54:55 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2024-09-09 11:54:55 -0400 |
commit | cdb6b0fdb0b2face270406905d31f8f513b015cc (patch) | |
tree | 855c93a72bbe36872fa0f768a496f1749d030c75 /doc/src | |
parent | 5bbdfa8a18dc56d3e64aa723a68e02e897cb5ec3 (diff) | |
download | postgresql-cdb6b0fdb0b2face270406905d31f8f513b015cc.tar.gz postgresql-cdb6b0fdb0b2face270406905d31f8f513b015cc.zip |
Add PQfullProtocolVersion() to surface the precise protocol version.
The existing function PQprotocolVersion() does not include the minor
version of the protocol. In preparation for pending work that will
bump that number for the first time, add a new function to provide it
to clients that may care, using the (major * 10000 + minor)
convention already used by PQserverVersion().
Jacob Champion based on earlier work by Jelte Fennema-Nio
Discussion: http://postgr.es/m/CAOYmi+mM8+6Swt1k7XsLcichJv8xdhPnuNv7-02zJWsezuDL+g@mail.gmail.com
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/libpq.sgml | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index 25646f6f8e0..783e8e750bb 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -2678,22 +2678,44 @@ const char *PQparameterStatus(const PGconn *conn, const char *paramName); </listitem> </varlistentry> + <varlistentry id="libpq-PQfullProtocolVersion"> + <term><function>PQfullProtocolVersion</function><indexterm><primary>PQfullProtocolVersion</primary></indexterm></term> + + <listitem> + <para> + Interrogates the frontend/backend protocol being used. +<synopsis> +int PQfullProtocolVersion(const PGconn *conn); +</synopsis> + Applications might wish to use this function to determine whether certain + features are supported. The result is formed by multiplying the server's + major version number by 10000 and adding the minor version number. For + example, version 3.2 would be returned as 30002, and version 4.0 would + be returned as 40000. Zero is returned if the connection is bad. The 3.0 + protocol is supported by <productname>PostgreSQL</productname> server + versions 7.4 and above. + </para> + <para> + The protocol version will not change after connection startup is + complete, but it could theoretically change during a connection reset. + </para> + </listitem> + </varlistentry> + <varlistentry id="libpq-PQprotocolVersion"> <term><function>PQprotocolVersion</function><indexterm><primary>PQprotocolVersion</primary></indexterm></term> <listitem> <para> - Interrogates the frontend/backend protocol being used. + Interrogates the frontend/backend protocol major version. <synopsis> int PQprotocolVersion(const PGconn *conn); </synopsis> - Applications might wish to use this function to determine whether certain - features are supported. Currently, the possible values are 3 - (3.0 protocol), or zero (connection bad). The protocol version will - not change after connection startup is complete, but it could - theoretically change during a connection reset. The 3.0 protocol is - supported by <productname>PostgreSQL</productname> server versions 7.4 - and above. + Unlike <xref linkend="libpq-PQfullProtocolVersion"/>, this returns only + the major protocol version in use, but it is supported by a wider range + of libpq releases back to version 7.4. Currently, the possible values are + 3 (3.0 protocol), or zero (connection bad). Prior to release version + 14.0, libpq could additionally return 2 (2.0 protocol). </para> </listitem> </varlistentry> |