#165 ✓ invalid
Psycopg website

Specials characters in password

Reported by Psycopg website | May 31st, 2013 @ 03:05 PM

Submitted by: olivier.margarit@cgi.com

Hi,
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
Thank you

Comments and changes to this ticket

  • Daniele Varrazzo

    Daniele Varrazzo June 1st, 2013 @ 10:44 AM

    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"
    

    Thank you.

  • Daniele Varrazzo

    Daniele Varrazzo June 18th, 2013 @ 10:06 AM

    • State changed from “new” to “invalid”

    Can't confirm the issue: I've tried creating an user with password @#!* and @#'"!* 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.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

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

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

Pages