Doc: update versioning information in libpq.sgml.

The descriptions of PQserverVersion and PQlibVersion hadn't been updated
for the new two-part version-numbering approach.  Fix that.

In passing, remove some trailing whitespace elsewhere in the file.
This commit is contained in:
Tom Lane 2017-07-21 17:50:57 -04:00
parent a46fe6e8be
commit e22efaabf1
1 changed files with 63 additions and 28 deletions

View File

@ -1844,17 +1844,36 @@ int PQprotocolVersion(const PGconn *conn);
<listitem> <listitem>
<para> <para>
Returns an integer representing the backend version. Returns an integer representing the server version.
<synopsis> <synopsis>
int PQserverVersion(const PGconn *conn); int PQserverVersion(const PGconn *conn);
</synopsis> </synopsis>
Applications might use this function to determine the version of the database </para>
server they are connected to. The number is formed by converting
the major, minor, and revision numbers into two-decimal-digit <para>
numbers and appending them together. For example, version 8.1.5 Applications might use this function to determine the version of the
will be returned as 80105, and version 8.2 will be returned as database server they are connected to. The result is formed by
80200 (leading zeroes are not shown). Zero is returned if the multiplying the server's major version number by 10000 and adding
connection is bad. the minor version number. For example, version 10.1 will be
returned as 100001, and version 11.0 will be returned as 110000.
Zero is returned if the connection is bad.
</para>
<para>
Prior to major version 10, <productname>PostgreSQL</> used
three-part version numbers in which the first two parts together
represented the major version. For those
versions, <function>PQserverVersion</> uses two digits for each
part; for example version 9.1.5 will be returned as 90105, and
version 9.2.0 will be returned as 90200.
</para>
<para>
Therefore, for purposes of determining feature compatibility,
applications should divide the result of <function>PQserverVersion</>
by 100 not 10000 to determine a logical major version number.
In all release series, only the last two digits differ between
minor releases (bug-fix releases).
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -6224,26 +6243,42 @@ int PQlibVersion(void);
<para> <para>
The result of this function can be used to determine, at The result of this function can be used to determine, at
run time, if specific functionality is available in the currently run time, whether specific functionality is available in the currently
loaded version of libpq. The function can be used, for example, loaded version of libpq. The function can be used, for example,
to determine which connection options are available for to determine which connection options are available in
<function>PQconnectdb</> or if the <literal>hex</> <type>bytea</> <function>PQconnectdb</>.
output added in PostgreSQL 9.0 is supported.
</para> </para>
<para> <para>
The number is formed by converting the major, minor, and revision The result is formed by multiplying the library's major version
numbers into two-decimal-digit numbers and appending them together. number by 10000 and adding the minor version number. For example,
For example, version 9.1 will be returned as 90100, and version version 10.1 will be returned as 100001, and version 11.0 will be
9.1.2 will be returned as 90102 (leading zeroes are not shown). returned as 110000.
</para>
<para>
Prior to major version 10, <productname>PostgreSQL</> used
three-part version numbers in which the first two parts together
represented the major version. For those
versions, <function>PQlibVersion</> uses two digits for each
part; for example version 9.1.5 will be returned as 90105, and
version 9.2.0 will be returned as 90200.
</para>
<para>
Therefore, for purposes of determining feature compatibility,
applications should divide the result of <function>PQlibVersion</>
by 100 not 10000 to determine a logical major version number.
In all release series, only the last two digits differ between
minor releases (bug-fix releases).
</para> </para>
<note> <note>
<para> <para>
This function appeared in <productname>PostgreSQL</> version 9.1, so This function appeared in <productname>PostgreSQL</> version 9.1, so
it cannot be used to detect required functionality in earlier it cannot be used to detect required functionality in earlier
versions, since linking to it will create a link dependency versions, since calling it will create a link dependency
on version 9.1. on version 9.1 or later.
</para> </para>
</note> </note>
</listitem> </listitem>