0
votes

using postgresql 9.4 on ubuntu 15.04.

logged in as postrges

created following roles: fooadmin, fooread, fooupdate with appropriate privileges for the role.

created following user: fooadminuser

granted role to user: grant fooadmin to fooadminuser;

log out of psql

attempt to login to psql using the following:

psql -U fooadminuser -h localhost -W

get prompted for password/enter password

receive following error message:

psql: FATAL: database "fooadminuser" does not exist

I thought I was doing this correctly by creating the roles, then creating the login users, then login with the user that has the createdb role and create the database.

Is there a way to override during login the attempt to access a non-existent database?

1
You should add tag postgresql to Your question. - Michas

1 Answers

2
votes

You have to connect to an existing database. If You don't provide it, the default is the same as the user. After installation there should be one database named 'postgres'. Try this command:

psql -U fooadminuser -h localhost -d postgres -W