Reputation: 1142
My psql does not open. Weirdly enough. I've created a user "Ben" through logging using psql -U postgres
that lets me open PSQL and I run a command
CREATE USER Ben WITH PASSWORD '123';
After I do that it says ERROR: role "ben" already exists
But when I run psql it throws me psql: FATAL: role "Ben" does not exist
Upvotes: 0
Views: 1228
Reputation: 30597
When you issue an SQL command like this:
CREATE USER Ben WITH PASSWORD '123';
identifiers within this command (such as the user name) are folded to lower case. So the user is actually created as 'ben'.
When you issue a shell command such as:
psql -U Ben mydatabase
then the identifier case is preserved, making it case sensitive.
If you really want the user name capitalized, then double quote it in SQL, like this:
CREATE USER "Ben" WITH PASSWORD '123';
Otherwise leave it all lower case and connect with:
psql -U ben mydatabase
See: Identifiers & Keywords in the manual
Upvotes: 1