Skip site navigation (1) Skip section navigation (2)

Re: Finding the pqlib version

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: (view raw, whole thread or download thread mbox)
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:
>    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();
	 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                        |
  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

In response to


pgsql-interfaces by date

Next:From: Christoph ZwerschkeDate: 2006-02-11 15:44:43
Subject: Re: Finding the pqlib version
Previous:From: Peter EisentrautDate: 2006-02-11 13:50:15
Subject: Re: Finding the pqlib version

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group