This project is archived and is in readonly mode.

#87 ✓resolved
Martijn Bastiaan

psycopg2.connect fails when using spaces in password-keyword

Reported by Martijn Bastiaan | January 2nd, 2012 @ 10:31 PM

Hi all,

Psycopg2 fails when trying to authenticate with spaces in a password. The following code illustrates the problem:

>>> import psycopg2
>>> psycopg2.connect(database='amcat', host='localhost', user='martijn', port='5433', password='foo baar') 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
psycopg2.OperationalError: missing "=" after "test" in connection info string

I've submitted a very simple patch, which resolves the problem, but introduces another problem: the object returned shows part of the password.

>>> psycopg2.connect(**params)
<connection object at 0x2449710; dsn: 'dbname=amcat host=localhost port=5433 user=martijn password=xxxxx baar', closed: 0>

I'm unable to locate the relevant lines. If anyone could point me in the right direction, I'd be more than happy to fix the that part too.

Kind regards,
Martijn

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

<b>WARNING:</b> the informations in this tracker are archived. Please submit new tickets or comments to <a href="https://github.com/psycopg/psycopg2/issues">the new tracker</a>.
<br/>
Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.

Shared Ticket Bins

Attachments

Pages