Re: BUG #2701: PQserverVersion function missing

Lists: pgsql-bugs
From: "Seth Gordon" <sethg+pg(at)ropine(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2701: PQserverVersion function missing
Date: 2006-10-17 13:25:40
Message-ID: 200610171325.k9HDPeLg065320@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 2701
Logged by: Seth Gordon
Email address: sethg+pg(at)ropine(dot)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.


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Seth Gordon <sethg+pg(at)ropine(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2701: PQserverVersion function missing
Date: 2006-10-21 18:29:17
Message-ID: 200610211829.k9LITHi23348@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Seth Gordon wrote:
>
> The following bug has been logged online:
>
> Bug reference: 2701
> Logged by: Seth Gordon
> Email address: sethg+pg(at)ropine(dot)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(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Seth Gordon <sethg+pg(at)ropine(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2701: PQserverVersion function missing
Date: 2006-10-21 20:12:27
Message-ID: 27403.1161461547@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Actually, the 8.0.X libpq function would still report 70401 if connected
> to a 7.4.1 database,

That was exactly the reason why the docs were written like that. Using
two examples that are both from the same major release doesn't seem to
me to be an improvement.

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Seth Gordon <sethg+pg(at)ropine(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2701: PQserverVersion function missing
Date: 2006-10-24 02:39:13
Message-ID: 200610240239.k9O2dDg03370@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > Actually, the 8.0.X libpq function would still report 70401 if connected
> > to a 7.4.1 database,
>
> That was exactly the reason why the docs were written like that. Using
> two examples that are both from the same major release doesn't seem to
> me to be an improvement.

Actually, the problem with 8.0.X is that the major version number had a
zero in it. 8.1 does not, so I think it is actually better to use the
same major version number in both examples. The second example is to
highlight that 8.1 has a trailing "00".

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Seth Gordon <sethg+pg(at)ropine(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2701: PQserverVersion function missing
Date: 2006-10-24 04:29:05
Message-ID: 3389.1161664145@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Tom Lane wrote:
>> Bruce Momjian <bruce(at)momjian(dot)us> writes:
>>> Actually, the 8.0.X libpq function would still report 70401 if connected
>>> to a 7.4.1 database,
>>
>> That was exactly the reason why the docs were written like that. Using
>> two examples that are both from the same major release doesn't seem to
>> me to be an improvement.

> Actually, the problem with 8.0.X is that the major version number had a
> zero in it. 8.1 does not, so I think it is actually better to use the
> same major version number in both examples.

You're ignoring the point at hand, which is exactly that the libpq
function will work when connected to servers older (in fact much older)
than it is.

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Seth Gordon <sethg+pg(at)ropine(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2701: PQserverVersion function missing
Date: 2006-10-24 21:11:07
Message-ID: 200610242111.k9OLB7k24697@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > Tom Lane wrote:
> >> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> >>> Actually, the 8.0.X libpq function would still report 70401 if connected
> >>> to a 7.4.1 database,
> >>
> >> That was exactly the reason why the docs were written like that. Using
> >> two examples that are both from the same major release doesn't seem to
> >> me to be an improvement.
>
> > Actually, the problem with 8.0.X is that the major version number had a
> > zero in it. 8.1 does not, so I think it is actually better to use the
> > same major version number in both examples.
>
> You're ignoring the point at hand, which is exactly that the libpq
> function will work when connected to servers older (in fact much older)
> than it is.

Fine, but the examples are not trying to show that. The example is to
show the trailing zero added for 8.1.

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

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