This project is archived and is in readonly mode.
Specials characters in password
Reported by Psycopg website | May 31st, 2013 @ 03:05 PM
Submitted by: firstname.lastname@example.org
I'm developing a webapp which connect to a postgresql db whith your framework.
One the password I use contains !, *, @, . Every best characters for developers we can find in just one password...
The password isn't recognized by the host postgres. This password finish with *.
When I use a simplest password it works with my script and the complex one success with jdbc driver of java.
I'm sure that there is no error on my password and I obtain this message:
Error FATAL: password authentication failed for user "user"
The version I use is not under, my release is 2.4.5
Comments and changes to this ticket
Please specify better: are you creating the connection using a connection string:
cnn = psycopg2.connect("dbname=foo password=abc")
or using separate arguments?
cnn = psycopg2.connect(database="foo" password="abc")
Does anything change switching method?
Can you connect via psql using exactly the same connection string of the first case?
psql "dbname=foo password=abc"
- State changed from new to invalid
Can't confirm the issue: I've tried creating an user with password
@#'"!*and found no problem connecting with either methods.
cnn = psycopg2.connect(user='testpw', password='@#!*' database='piro') cnn = psycopg2.connect('user=testpw password=@#!* dbname=piro') cnn = psycopg2.connect(user='testpw', password='@#\'"!*', database='piro') cnn = psycopg2.connect(r"""user=testpw password='@#\'"!*' dbname=piro""")
In the last case the password must be escaped according to the PQconnectdb rule: the rule is applied authomatically in the 3rd example.
Tested with psycopg 2.5 and postgres 9.2.4.
Please reopen if you can provide a failing example and report postgres and psycopg versions.
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>.
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.