From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Christoph Zwerschke <cito(at)online(dot)de> |
Cc: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | Re: Finding the pqlib version |
Date: | 2006-02-11 15:01:44 |
Message-ID: | 200602111501.k1BF1i017587@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
Christoph Zwerschke wrote:
> I want to add the PQCancel() functionality to PyGreSQL.
> Until now, PyGreSQL works with PostgreSQL 7.3+, but
> unfortunately, PQCancel() is only available from 8.0+.
>
> In order to not break compilation of PyGreSQL on systems with PG7,
> I would like to do something like the following:
>
> #if PQLIB_VERSION_MAJOR < 8
> PQRequestCancel(conn)
> #else
> c = PQgetCancel(conn)
> PQCancel(c, errbuf, 256)
> PQfreeCancel(c)
> #end
>
> However, there is no such thing as "PQLIB_VERSION_MAJOR".
> Anything else I could query instead?
You want the server version. In PostgreSQL 8.0 and later you can use
libpq's PQserverVersion(), but for pre-8.0, I think you have to do
SELECT version(), and parse that:
test=> SELECT version();
version
------------------------------------------------------------------
PostgreSQL 8.2devel on i386-pc-bsdi4.3.1, compiled by GCC 2.95.3
(1 row)
I would also look how other interfaces are doing this.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Christoph Zwerschke | 2006-02-11 15:44:43 | Re: Finding the pqlib version |
Previous Message | Peter Eisentraut | 2006-02-11 13:50:15 | Re: Finding the pqlib version |