Python client lib for PostgreSQL8

Peter Maas peter at somewhere.com
Fri Nov 19 06:38:24 EST 2004


Gerhard Haering schrieb:
> On Thu, Nov 18, 2004 at 01:58:48PM +0100, Peter Maas wrote:
> 
>>I just tried to connect to a PostgreSQL8 beta2 database server with
>>pyPgSQL 2.4 and got a libpq.DatabaseError telling "Ivalid format for
>>PgVersion construction".
[...]
> Attached is a quick, completely untested try. If it doesn't work like this, you
> should get the idea how to make it work ;-)

Thanks, Gerhard, but it doesn't work.

The error is due to pgversion.c/parseToken(). Parsing the vstr info
into major, minor, patch doesn't work. The version string from
"SELECT version();" is

PostgreSQL 8.0.0beta4 on ...

parseToken() handles beta versions too restrictive allowing only ...b4
instead of ...beta4. I have relaxed this condition by replacing the line

     *result = strtol(token, &last, 0);

by

     *result = strtol(token, &last, 0);
     return (errno != 0);

thus allowing everything after the patch number. This is perhaps
too permissive but my test script with a simple SELECT statement
works now.

-- 
-------------------------------------------------------------------
Peter Maas,  M+R Infosysteme,  D-52070 Aachen,  Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------



More information about the Python-list mailing list