Re: error pypgsql "Ivalid format for PgVersion construction"

Terry at i3 <terry-TU+o4ct7AZYNcFTW2g63AdBc4/[email protected]> Wed, 29 Dec 2004 09:56:06 +0000
Newsgroups gmane.comp.python.db.pypgsql.user
Organization i3 Technologies Ltd
Message-ID <[email protected]>
I may be wrong but I had a similar problem and it was fixed by a patch
on the sourceforge site. 

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.
> 
> :'( :'( :'( :'(
> 
> 
> ==============================================
> my server (no problem):
> basecsd=# SELECT pg_catalog.pg_client_encoding();
> pg_client_encoding
> --------------------
> SQL_ASCII
> (1 fila)
> basecsd=# SELECT version();
>                                                 version 
> -------------------------------------------------------------------------------------------------------
> 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)
> 
> 
> server external (error server):
> basecsd=> SELECT pg_catalog.pg_client_encoding();
> pg_client_encoding
> --------------------
> SQL_ASCII
> (1 fila)    
> basecsd=> select version();
>                                                    version 
> -------------------------------------------------------------------------------------------------------------
> 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)
> ==============================================
> 
> 
> 
> 
> El mié, 29-12-2004 a las 07:36 +0100, Gerhard Quell escribió: 
> 
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > Use this:
> > 
> > c1=PgSQL.connect('host:port:database:user:password:options:tty')
> > 
> > 
> > basic usage:
> > ~ PgSQL.connect(connect_string) -> connection  connect_string
> > ~ ='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='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.
> > 
> > 
> > 
> > Hector Miuler Malpica Gallegos wrote:
> > | Hello, I have problems with pypgsql, by means of psql I can be
> > | connected to a server with Postgresql=7.3.6, to a data base in which 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:
> > |
> > |
> > ===========================================================================
> > |
> > |>>>from pyPgSQL import PgSQL
> > |>>>c1=PgSQL.connect(user="xxxx", password="xxxxxxx",
> > |
> > | host="serverxxx.xxx", database="xxx")
> > | 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 2331,
> > | in __init__
> > |     raise DatabaseError, m
> > | libpq.DatabaseError: Ivalid format for PgVersion construction.
> > |
> > ===========================================================================
> > |
> > |
> > ===========================================================================
> > |
> > |>>>from pyPgSQL import libpq
> > |>>>libpq.PQconnectdb('host=serverxxx.xxx password=xxxxxxx user=xxx
> > dbname=xxxxxxx')
> > |
> > | Traceback (most recent call last):
> > |   File "<stdin>", line 1, in ?
> > | ValueError:
> > 
> > 
> > - --
> > - ------------------------------------------------------ skequell ------
> > ~ Gerhard Quell                       Software & Knowledge Engineering
> > ~ Schützenweg 3      eMail:     gquell-N1YKUU++/[email protected]  Fon: 0731-26400651
> > ~ 89275 Elchingen    web  : http://www.skequell.de  Fax: 0731-26400652
> > - --------------- 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
> > 
> > iD8DBQFB0lBAvHbZD0c+xTwRAhVRAKCp4IbsprzeUmH1I12qSS5PGuanCACgkKnt
> > 2C7sdhdayc5XzgwtTQD3Wew=
> > =6tSF
> > -----END PGP SIGNATURE-----
> > 
> > 
> > -------------------------------------------------------
> > SF email is sponsored by - The IT Product Guide
> > Read honest & candid reviews on hundreds of IT Products from real users.
> > Discover which products truly live up to the hype. Start reading now. 
> > http://productguide.itmanagersjournal.com/
> > _______________________________________________
> > Pypgsql-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/pypgsql-users
> 
> -- 
> Hector Miuler Malpica Gallegos <[email protected]>


________________________________________________________________________
Terry MacDonald MBA BEng
MIEE
Director and Principal
Consultant
i3 Technologies Ltd
Thunderbird - Reclaim
your inbox  
Get Firefox affiliated
link