CREATE USER "user" NOCREATEDB NOCREATEUSER NOINHERIT ENCRYPTED PASSWORD 'database'
CREATE DATABASE "database" WITH OWNER "user"
The user creating the db is not psql default. Is a user who creates dbs on server and have the roles creatdb and create role. Can i give to this user a superuser privilege?
Sorry for the noob questions, but i'm new on postgres and have this thing to resolve. Is a legacy system on the company.
I'm new on postgres. I'm trying to create a database with a user who have CREATEDB role. But I'm getting this error
You need to provide the code that you are running, not just the resultant error message.
David J.
Hi macros,
The user issuing the CREATE DATABASE must be a member of the role that will be the owner of the database.
Compare the below example:
postgres=>CREATE ROLE o;
CREATE ROLE
postgres=>CREATEDATABASE d OWNER = o;
ERROR: must be member of role "o"
postgres=>GRANT o TO root;GRANT ROLE
postgres=>CREATEDATABASE d OWNER = o;CREATEDATABASE