Python client lib for PostgreSQL8

P

Peter Maas

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".

Is there already a PyPgSQL version in CVS or another client library
that handles PostgreSQL 8?
 
G

Gerhard Haering

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".

Is there already a PyPgSQL version in CVS or another client library
that handles PostgreSQL 8?

Oh, I wanted to fix that since some time ago.

Attached is a quick, completely untested try. If it doesn't work like this, you
should get the idea how to make it work ;-)

-- Gerhard

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBnKlHdIO4ozGCH14RAiLTAJ4vuRpjlBYiKe7K3w5hSNdqz92CvgCeN8ty
nMWLDmkwA6j2dV83b0+Q18I=
=hSiu
-----END PGP SIGNATURE-----
 
M

Michael Fuhr

Peter Maas said:
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".

This bug was reported over three months ago:

http://sourceforge.net/tracker/index.php?func=detail&aid=1006782&group_id=16528&atid=116528
Is there already a PyPgSQL version in CVS or another client library
that handles PostgreSQL 8?

A lot of people like psycopg.

http://initd.org/software/initd/psycopg
 
P

Peter Maas

Gerhard said:
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.
 
P

Peter Maas

Michael said:

Thanks, Michael. Does it handle PostgreSQL 8beta? I didn't try psycopg
yet because I used to work at a Win2k computer and wasn't able to
compile it. C++Builder didn't work and I was not in the mood to buy
MSVC for compiling Python extensions).

Now I've made the jump to a Linux workstation but I still prefer
software that I can install on several platforms without hassle.
I don't have any clue what advantages psycopg has over pyPgSQL.
Are there comparisons / benchmarks available?
 
M

Michael Fuhr

Peter Maas said:
Thanks, Michael. Does it handle PostgreSQL 8beta?

Yes -- I use psycopg with the PostgreSQL 8.0 betas.
Now I've made the jump to a Linux workstation but I still prefer
software that I can install on several platforms without hassle.
I don't have any clue what advantages psycopg has over pyPgSQL.
Are there comparisons / benchmarks available?

Psycopg can be a lot faster than pyPgSQL or PyGreSQL, especially
when retrieving large data sets. You could google for comparisons,
but the most meaningful benchmarks would be those that you ran
against your own data.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top