Re: Cannot log in as newly created user - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Cannot log in as newly created user
Date
Msg-id 21219.1450707779@sss.pgh.pa.us
Whole thread Raw
In response to Cannot log in as newly created user  (Emma Saurus <emmasaurus@westnet.com.au>)
List pgsql-bugs
Emma Saurus <emmasaurus@westnet.com.au> writes:
> postgres=# CREATE ROLE EmmaChwan CREATEDB LOGIN PASSWORD 'password';
>>> CREATE ROLE
> postgres=# \q

> C:\Users\EmmaChwan>psql
>>> Password:
>>> psql: FATAL:  password authentication failed for user "EmmaChwan"

Your problem here is case sensitivity, or lack of it.  The unquoted
identifier EmmaChwan is smashed to lower case when seen in a SQL
command, so the actually created user name is "emmachwan".  But when
you submit a user (or database) name in a connection request, that's
not SQL language so no quote-stripping or case-folding is done.

You can make it work with

    CREATE ROLE "EmmaChwan" ...

but bear in mind you'll have to double-quote that user name *every*
time you refer to it in SQL.  The same goes for any other mixed-case
name that you want to be really truly mixed-case and not case-insensitive.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Greg Clough
Date:
Subject: Re: BUG #13770: Extending recovery_min_apply_delay on Standby causes it to be unavailable for a while
Next
From: Grzegorz Garlewicz
Date:
Subject: Re: BUG #13824: EXISTS sometimes uses seq scan instead of index