pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Christoph Zwerschke <cito@online.de>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: Finding the pqlib version
Date: Sat, 11 Feb 2006 10:01:44 -0500 (EST)
Message-ID: <200602111501.k1BF1i017587@candle.pha.pa.us> (raw)
In-Reply-To: <43EDC399.6060203@online.de>

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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073



view thread (33+ messages)  latest in thread

Message-ID: <200602111501.k1BF1i017587@candle.pha.pa.us>
Permalink:  ../200602111501.k1BF1i017587@candle.pha.pa.us/
Also on:    postgresql.org/message-id/200602111501.k1BF1i017587@candle.pha.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: pgman@candle.pha.pa.us, cito@online.de
  Subject: Re: Finding the pqlib version
  In-Reply-To: <200602111501.k1BF1i017587@candle.pha.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox