Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Specials characters in password

#165

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

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

State: invalid
Milestone: none
Assigned to: nobody

Activity

  1. Daniele Varrazzo
    Daniele Varrazzo

    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.

    June 1st, 2013 @ 10:44 AM

  2. Daniele Varrazzo
    Daniele Varrazzo
    • 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.

    June 18th, 2013 @ 10:06 AM