0

I found the problem here among many other solutions for *nix systems, but I couldn't seem to access psql

Simply throws a fatal error telling that role Username doesn't exist while I have just created the role and can explicitly see that role there in the list

enter image description here

Things were going super smooth with sqlite and now I need to migrate all data from sqlite3 to PostgreSQL and I'm stuck here for hours...! What do I do?

4
  • psql version 9.6.1 on windows 10 in case that matters Commented Nov 2, 2016 at 10:42
  • 2
    Could it be case sensitivity? The role name "zeke" in postgresql is not the same as "Zeke" - because you gave the command without quoting the name it's all lower case... stackoverflow.com/questions/21796446/… Commented Nov 2, 2016 at 10:50
  • it is indeed! such a silly thing...! Commented Nov 2, 2016 at 10:59
  • is there a way to make postgres take username instead of Username as default? Commented Nov 2, 2016 at 11:01

1 Answer 1

4

Solution 1: Use doublequotes to preserve case: psql -U postgres -c "CREATE ROLE \"Zeke\""

In Windows usernames are usually given as Username but psql command refuses to preserve case! and this is causing the error...

Solution 2: psql -U zeke

I still wonder if there exists any solution for taking usernames in windows as lowercase characters! Adding an ENV variable PGUSER helps get rid of -U zeke after every psql cmd

Sign up to request clarification or add additional context in comments.

3 Comments

PGUSER Environment Variable or create role "Zeke" ... Also look at the User Name Maps
You missed doublequotes around the role name in my comment.
yep! it works: psql -U postgres -c "CREATE ROLE \"Zeke\""

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.