Re: Finding the pqlib version

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Finding the pqlib version
Дата
Msg-id 200602111501.k1BF1i017587@candle.pha.pa.us
обсуждение исходный текст
Ответ на Finding the pqlib version  (Christoph Zwerschke <cito@online.de>)
Ответы Re: Finding the pqlib version  (Christoph Zwerschke <cito@online.de>)
Список 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,
compiledby 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,
Pennsylvania19073
 


В списке pgsql-interfaces по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Finding the pqlib version
Следующее
От: Christoph Zwerschke
Дата:
Сообщение: Re: Finding the pqlib version