With PostgreSQL 15, there has been a change in the way table creation permissions are handled for users. Not directly related to pgAdmin, but I think people may run into this.
Normally, after allowing a user to CREATE tables within a database, you didn’t have to specifically define that they had the permission to do that within a SCHEMA, since public
would be the default one.
With PostgreSQL 15, this has changed (source):
PostgreSQL 15 also revokes the CREATE permission from all users except
a database owner from the public (or default) schema.
So one would get the following error:
ERROR: permission denied for schema public
Now your flow should look like this:
CREATE DATABASE EXAMPLE_DB;
CREATE USER EXAMPLE_USER WITH ENCRYPTED PASSWORD 'Sup3rS3cret';
GRANT ALL PRIVILEGES ON DATABASE EXAMPLE_DB TO EXAMPLE_USER;
\c EXAMPLE_DB postgres
# You are now connected to database "EXAMPLE_DB" as user "postgres".
GRANT ALL ON SCHEMA public TO EXAMPLE_USER;
Obviously change the privileges as you need.
The last step, where we explicitly tell that EXAMPLE_USER
has privileges on schema public
within EXAMPLE_DB
is introduced in PostgreSQL 15.