From: Terry at i3 <te...@i3...> - 2004-12-29 09:56:18
|
I may be wrong but I had a similar problem and it was fixed by a patch on the sourceforge site.=20 Basically when you connect to postgres the postgres version is returned to your app via pypgsql. the pypgsql code that handles this is in PgVersion.c. In RedHat versions of postgres the version string has an RH appended to it (why??) and the pypgsql code does not handle that eventuality therefore the connection fails. The patch just makes the acceptance of a valid version string looser. Cheers On Wed, 2004-12-29 at 08:28, Hector Miuler Malpica Gallegos wrote: > >>> PgSQL.connect('xxxxxxx.com:5432:basexxxx:userxxx:passxxxxxx') > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File "/usr/lib/python2.3/site-packages/pyPgSQL/PgSQL.py", line 2211, > in connect > return Connection(connInfo, client_encoding, unicode_results) > File "/usr/lib/python2.3/site-packages/pyPgSQL/PgSQL.py", line 2332, > in __init__ > raise DatabaseError, m > libpq.DatabaseError: Ivalid format for PgVersion construction. >=20 > :'( :'( :'( :'( >=20 >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > my server (no problem): > basecsd=3D# SELECT pg_catalog.pg_client_encoding(); > pg_client_encoding > -------------------- > SQL_ASCII > (1 fila) > basecsd=3D# SELECT version(); > version=20 > -----------------------------------------------------------------------= -------------------------------- > PostgreSQL 7.4.6 on i386-pc-linux-gnu, compiled by GCC i386-linux-gcc > (GCC) 3.3.4 (Debian 1:3.3.4-13) > (1 fila) >=20 >=20 > server external (error server): > basecsd=3D> SELECT pg_catalog.pg_client_encoding(); > pg_client_encoding > -------------------- > SQL_ASCII > (1 fila) =20 > basecsd=3D> select version(); > version=20 > -----------------------------------------------------------------------= -------------------------------------- > PostgreSQL 7.3.6-RH on i686-pc-linux-gnu, compiled by GCC gcc (GCC) > 3.2.3 20030502 (Red Hat Linux 3.2.3-20) > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 >=20 >=20 >=20 > El mi=C3=A9, 29-12-2004 a las 07:36 +0100, Gerhard Quell escribi=C3=B3:= =20 >=20 > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > >=20 > > Use this: > >=20 > > c1=3DPgSQL.connect('host:port:database:user:password:options:tty') > >=20 > >=20 > > basic usage: > > ~ PgSQL.connect(connect_string) -> connection connect_string > > ~ =3D'host:port:database:user:password:options:tty' > > ~ All parts are optional. You may also pass the information in as > > ~ keyword arguments with the following keywords: 'host', 'port', > > ~ 'database', 'user', 'password', 'options', and 'tty'. The port > > ~ may also be passed in as part of the host keyword parameter, > > ~ ie. host=3D'localhost:5432'. Other optional parameters are > > ~ client_encoding and unicode_results. If unicode_results is true, > > ~ all strings from the backend are returned as Unicode strings. > > ~ client_encoding accepts the same parameters as the encode method > > ~ of Unicode strings. If you also want to set a policy for encoding > > ~ errors, set client_encoding to a tuple, like ("koi8-r", "replace") > > ~ Note that you still must make sure that the PostgreSQL client is > > ~ using the same encoding as set with the client_encoding parameter. > > ~ This is typically done by issuing a "SET CLIENT_ENCODING TO ..." > > ~ SQL statement immediately after creating the connection. > >=20 > >=20 > >=20 > > Hector Miuler Malpica Gallegos wrote: > > | Hello, I have problems with pypgsql, by means of psql I can be > > | connected to a server with Postgresql=3D7.3.6, to a data base in wh= ich I > > | have access to everything. > > | When attempt to connect to me with pypgsql I cannot, with others > > | librerias for poststoneware if I can, this is the error message: > > | > > | > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D > > | > > |>>>from pyPgSQL import PgSQL > > |>>>c1=3DPgSQL.connect(user=3D"xxxx", password=3D"xxxxxxx", > > | > > | host=3D"serverxxx.xxx", database=3D"xxx") > > | Traceback (most recent call last): > > | File "<stdin>", line 1, in ? > > | File "/usr/lib/python2.3/site-packages/pyPgSQL/PgSQL.py", line 22= 11, > > | in connect > > | return Connection(connInfo, client_encoding, unicode_results) > > | File "/usr/lib/python2.3/site-packages/pyPgSQL/PgSQL.py", line 23= 31, > > | in __init__ > > | raise DatabaseError, m > > | libpq.DatabaseError: Ivalid format for PgVersion construction. > > | > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D > > | > > | > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D > > | > > |>>>from pyPgSQL import libpq > > |>>>libpq.PQconnectdb('host=3Dserverxxx.xxx password=3Dxxxxxxx user=3D= xxx > > dbname=3Dxxxxxxx') > > | > > | Traceback (most recent call last): > > | File "<stdin>", line 1, in ? > > | ValueError: > >=20 > >=20 > > - -- > > - ------------------------------------------------------ skequell ---= --- > > ~ Gerhard Quell Software & Knowledge Engineerin= g > > ~ Sch=C3=BCtzenweg 3 eMail: gq...@sk... Fon: 0731-26= 400651 > > ~ 89275 Elchingen web : http://www.skequell.de Fax: 0731-2640065= 2 > > - --------------- pgp: 473EC53C - http://www.keyserver.net/en------= --- > > -----BEGIN PGP SIGNATURE----- > > Version: GnuPG v1.3.92 (GNU/Linux) > > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > >=20 > > iD8DBQFB0lBAvHbZD0c+xTwRAhVRAKCp4IbsprzeUmH1I12qSS5PGuanCACgkKnt > > 2C7sdhdayc5XzgwtTQD3Wew=3D > > =3D6tSF > > -----END PGP SIGNATURE----- > >=20 > >=20 > > ------------------------------------------------------- > > SF email is sponsored by - The IT Product Guide > > Read honest & candid reviews on hundreds of IT Products from real use= rs. > > Discover which products truly live up to the hype. Start reading now.= =20 > > http://productguide.itmanagersjournal.com/ > > _______________________________________________ > > Pypgsql-users mailing list > > Pyp...@li... > > https://lists.sourceforge.net/lists/listinfo/pypgsql-users >=20 > --=20 > Hector Miuler Malpica Gallegos <mi...@gm...> ________________________________________________________________________ Terry MacDonald MBA BEng MIEE Director and Principal Consultant i3 Technologies Ltd Thunderbird - Reclaim your inbox =20 Get Firefox affiliated link =20 |