16

I created a new database test and created user 'eonil' with this command:

CREATE ROLE eonil LOGIN ENCRYPTED PASSWORD 'password' NOINHERIT VALID UNTIL 'infinity';

on my PostgreSQL. I run psql -U eonil test. When I tried to make a new schema, it shows an error.

test=> CREATE SCHEMA new_schema AUTHORIZATION eonil;
ERROR:  permission denied for database test
test=> 

Why does this make an error? What's required?

Eonil
  • 9,689
  • 15
  • 34
  • 53

1 Answers1

26

Grant the user CREATE privilege on the database, e.g.

GRANT CREATE ON DATABASE test TO eonil

The CREATE privilege, when applied to an existing database, enables the User to create a new schema within the database. The official documentation for what other access privileges you can GRANT is here.

La-comadreja
  • 103
  • 3
Magnus Hagander
  • 2,227
  • 15
  • 9