aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2010-12-22 14:23:56 +0100
committerMagnus Hagander <magnus@hagander.net>2010-12-22 14:23:56 +0100
commitde9a4c27fefcc0d104bc9c97f4a93a49a25bf66d (patch)
treef35f5981172774dde3bac35c530eb9e190c6b0bb /doc/src
parent32ba2b516066688ff56e6d62a7ff4a01c88f5700 (diff)
downloadpostgresql-de9a4c27fefcc0d104bc9c97f4a93a49a25bf66d.tar.gz
postgresql-de9a4c27fefcc0d104bc9c97f4a93a49a25bf66d.zip
Add PQlibVersion() function to libpq
This function is like the PQserverVersion() function except it returns the version of libpq, making it possible for a client program or driver to determine which version of libpq is in use at runtime, and not just at link time. Suggested by Harald Armin Massa and several others.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/libpq.sgml44
1 files changed, 44 insertions, 0 deletions
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index c5024393566..7aac6f6829e 100644
--- a/doc/src/sgml/libpq.sgml
+++ b/doc/src/sgml/libpq.sgml
@@ -5359,6 +5359,50 @@ void *PQresultAlloc(PGresult *res, size_t nBytes);
</listitem>
</varlistentry>
+ <varlistentry id="libpq-pqlibversion">
+ <term>
+ <function>PQlibVersion</function>
+ <indexterm>
+ <primary>PQlibVersion</primary>
+ <seealso>PQserverVersion</seealso>
+ </indexterm>
+ </term>
+
+ <listitem>
+ <para>
+ Return the version of <productname>libpq</> that is being used.
+<synopsis>
+int PQlibVersion(void);
+</synopsis>
+ </para>
+
+ <para>
+ The result of this function can be used to determine, at
+ runtime, if 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.
+ </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).
+ </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.
+ </para>
+ </note>
+ </listitem>
+ </varlistentry>
+
</variablelist>
</sect1>