Skip site navigation (1) Skip section navigation (2)

BUG #5431: CREATE USER is not case sensitive, but psql command line arguments are

From: "Evan Nelson" <ean5533(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5431: CREATE USER is not case sensitive, but psql command line arguments are
Date: 2010-04-19 18:52:44
Message-ID: 201004191852.o3JIqiMK012314@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      5431
Logged by:          Evan Nelson
Email address:      ean5533(at)gmail(dot)com
PostgreSQL version: 8.4
Operating system:   Ubuntu 9.10
Description:        CREATE USER is not case sensitive, but psql command line
arguments are
Details: 

When creating a user (via CREATE USER/ROLE), the username you choose is not
case sensitive (e.g. "nEWuSer" is saved as "newuser"). However, the command
line arguments for psql ARE case sensitive. This means that if I create a
user like "newUser", then try to log into postgres via psql as "newUser",
I'll be told the the role doesn't exist. Then, when I log into postgres as
an existing user and try to re-create the role "newUser", postgres will tell
me that the role already exists -- a frustrating cycle. See below for a
quick example of what I mean:


----------------------------------

::~$ psql -d MyDatabase
psql (8.4.3)
Type "help" for help.

MyDatabase=# create user newUser;
CREATE ROLE
MyDatabase=# \q
::~$ psql -d MyDatabase -U newUser;
psql: FATAL:  role "newUser" does not exist
::~$ psql -d MyDatabase;
psql (8.4.3)
Type "help" for help.

MyDatabase=# create user newUser;
ERROR:  role "newuser" already exists
MyDatabase=# \q
::~$ psql -d MyDatabase -U newuser;
psql (8.4.3)
Type "help" for help.

MyDatabase=>

----------------------------------


I'm not sure what the proper solution for this problem is. Perhaps psql
should automatically convert typed usernames to lower case? Maybe warn about
case sensitivity when attempting to log in with a non-lowercase username? Or
maybe even issue a warning when CREATE USER is typed with a non-lowercase
username? Something else?

Responses

pgsql-bugs by date

Next:From: Robert HaasDate: 2010-04-19 19:29:56
Subject: Re: bugs that have not been replied-to on list
Previous:From: Kevin GrittnerDate: 2010-04-19 15:55:41
Subject: Re: bugs that have not been replied-to on list

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group