Commit e22efaab authored by Tom Lane's avatar Tom Lane

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.
parent a46fe6e8
......@@ -1844,17 +1844,36 @@ int PQprotocolVersion(const PGconn *conn);
<listitem>
<para>
Returns an integer representing the backend version.
Returns an integer representing the server version.
<synopsis>
int PQserverVersion(const PGconn *conn);
</synopsis>
Applications might use this function to determine the version of the database
server they are connected to. The number is formed by converting
the major, minor, and revision numbers into two-decimal-digit
numbers and appending them together. For example, version 8.1.5
will be returned as 80105, and version 8.2 will be returned as
80200 (leading zeroes are not shown). Zero is returned if the
connection is bad.
</para>
<para>
Applications might use this function to determine the version of the
database server they are connected to. The result is formed by
multiplying the server's major version number by 10000 and adding
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>
</listitem>
</varlistentry>
......@@ -6224,26 +6243,42 @@ int PQlibVersion(void);
<para>
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,
to determine which connection options are available for
<function>PQconnectdb</> or if the <literal>hex</> <type>bytea</>
output added in PostgreSQL 9.0 is supported.
to determine which connection options are available in
<function>PQconnectdb</>.
</para>
<para>
The result is formed by multiplying the library's major version
number by 10000 and adding the minor version number. For example,
version 10.1 will be returned as 100001, and version 11.0 will be
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>
The number is formed by converting the major, minor, and revision
numbers into two-decimal-digit numbers and appending them together.
For example, version 9.1 will be returned as 90100, and version
9.1.2 will be returned as 90102 (leading zeroes are not shown).
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>
<note>
<para>
This function appeared in <productname>PostgreSQL</> version 9.1, so
it cannot be used to detect required functionality in earlier
versions, since linking to it will create a link dependency
on version 9.1.
versions, since calling it will create a link dependency
on version 9.1 or later.
</para>
</note>
</listitem>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment