Subject: [PATCH] Advise devs to prefer server_version_num over parsing the version

From: Craig Ringer <[email-masked]>
Date: Fri, 6 Feb 2015 16:52:54 +1100

We've had server_version_num since 8.2.

Advise devs to prefer to use it instead of parsing version() or
server_version .

-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
From db8b82c54e492312c3dc6d908179075338961adf Mon Sep 17 00:00:00 2001
From: Craig Ringer <[email-masked]>
Date: Fri, 6 Feb 2015 16:49:53 +1100
Subject: [PATCH] Advise devs to use server_version_num

---
 doc/src/sgml/func.sgml | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 6d4f331..0d76f9f 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -14449,7 +14449,7 @@ SELECT * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
       <row>
        <entry><literal><function>version()</function></literal></entry>
        <entry><type>text</type></entry>
-       <entry><productname>PostgreSQL</> version information</entry>
+       <entry><productname>PostgreSQL</> version information. See also <xref linkend="guc-server-version-num"> for a machine-readable version.</entry>
       </row>
      </tbody>
     </tgroup>
@@ -14636,7 +14636,12 @@ SET search_path TO <replaceable>schema</> <optional>, <replaceable>schema</>, ..
 
    <para>
     <function>version</function> returns a string describing the
-    <productname>PostgreSQL</productname> server's version.
+    <productname>PostgreSQL</productname> server's version. You can also
+    get this information from <xref linkend="guc-server-version"> or
+    for a machine-readable version, <xref linkend="guc-server-version-num">.
+    Software developers should use <literal>server_version_num</literal>
+    (available since 8.2) or <xref linkend="libpq-pqserverversion"> instead
+    of parsing the text version.
    </para>
 
   <indexterm>
-- 
2.1.0

-- 
Sent via pgsql-docs mailing list ([email-masked])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs

---

From: Bruce Momjian <[email-masked]>
Date: Tue, 28 Apr 2015 20:31:19 -0400

On Fri, Feb  6, 2015 at 04:52:54PM +1100, Craig Ringer wrote:
> Advise devs to prefer to use it instead of parsing version() or server_version

Patch applied.

-- 
  Bruce Momjian  <[email-masked]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +