Thread: ERROR: 42501: must be member of role "*"
Hello
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 ERROR: 42501: must be member of role "name"
I need a user to create different databases automatically via a control panel. The strange is that is a legacy code who was working perfectly and don't have nothing documented.
I'm using postgress 8.4
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 ERROR: 42501: must be member of role "name"
I need a user to create different databases automatically via a control panel. The strange is that is a legacy code who was working perfectly and don't have nothing documented.
I'm using postgress 8.4
Why do not you use a newer version of PostgreSQL,? from the range of 9
2018-02-06 15:09 GMT-03:00 marcos sr <msr.mailing@gmail.com>:
Hello
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 ERROR: 42501: must be member of role "name"
I need a user to create different databases automatically via a control panel. The strange is that is a legacy code who was working perfectly and don't have nothing documented.
I'm using postgress 8.4
On Tuesday, February 6, 2018, marcos sr <msr.mailing@gmail.com> wrote:
Hello
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 ERROR: 42501: must be member of role "name"
You need to provide the code that you are running, not just the resultant error message.
David J.
Hello David thanks for attention,
CREATE USER "user" NOCREATEDB NOCREATEUSER NOINHERIT ENCRYPTED PASSWORD 'database'
CREATE DATABASE "database" WITH OWNER "user"
Sorry for the top-posting. now it's correct?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.
2018-02-06 16:13 GMT-02:00 David G. Johnston <david.g.johnston@gmail.com>:
On Tuesday, February 6, 2018, marcos sr <msr.mailing@gmail.com> wrote:Hello
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 ERROR: 42501: must be member of role "name"You need to provide the code that you are running, not just the resultant error message.David J.
On Feb 7, 2018 12:35 AM, "marcos sr" <msr.mailing@gmail.com> wrote:
Hi macros,Hello David thanks for attention,Sorry for the top-posting. now it's correct?
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.2018-02-06 16:13 GMT-02:00 David G. Johnston <david.g.johnston@gmail.com>:On Tuesday, February 6, 2018, marcos sr <msr.mailing@gmail.com> wrote:Hello
I'm new on postgres. I'm trying to create a database with a user who have CREATEDB role. But I'm getting this errorYou need to provide the code that you are running, not just the resultant error message.David J.
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=> CREATE DATABASE d OWNER = o;
ERROR: must be member of role "o"
postgres=> GRANT o TO root;
GRANT ROLE
postgres=> CREATE DATABASE d OWNER = o;
CREATE DATABASE
Regards,
Pavan,
Sent from my phone