Re: BUG #2701: PQserverVersion function missing - Mailing list pgsql-bugs

From Bruce Momjian
Subject Re: BUG #2701: PQserverVersion function missing
Date
Msg-id 200610211829.k9LITHi23348@momjian.us
Whole thread Raw
In response to BUG #2701: PQserverVersion function missing  ("Seth Gordon" <sethg+pg@ropine.com>)
Responses Re: BUG #2701: PQserverVersion function missing  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Seth Gordon wrote:
>
> The following bug has been logged online:
>
> Bug reference:      2701
> Logged by:          Seth Gordon
> Email address:      sethg+pg@ropine.com
> PostgreSQL version: 7.4.7
> Operating system:   Linux (Debian stable)
> Description:        PQserverVersion function missing
> Details:
>
> The 8.0/8.1 documentation for libpq says the following about
> PQserverVersion:
>
> "Applications may use this 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 7.4.2 will be returned as 70402, and version
> 8.1 will be returned as 80100 (leading zeroes are not shown). Zero is
> returned if the connection is bad."
>
> But libpq for 7.4.7 does not have this function.  So this is either a bug in
> the 7.4 code or a bug in the 8.1 documentation.

Good point. I changed the example to use 8.1.X:

    For example, version 8.1.5 will be returned as 80105, and version
    8.1 will be returned as 80100 (leading zeroes are not shown).  Zero is
    returned if the connection is bad.

Actually, the 8.0.X libpq function would still report 70401 if connected
to a 7.4.1 database, but it seems best to use a newer release number as
an example.

(Historically, 7.4.X was chosen as an example because at the time the
function was added in 8.0, we didn't know a valid 8.0.X minor version
number.)

--
  Bruce Momjian   bruce@momjian.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

pgsql-bugs by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: BUG #2709: how to start postgresql at startup
Next
From: Bruce Momjian
Date:
Subject: Re: BUG #2703: Cosmetic documentation error