Can't create tables in public schema as non-superuser
postgres - super user.
What I've done:
ALTER SCHEMA public owner to postgres;
CREATE USER admin WITH PASSWORD 'my-password';
GRANT USAGE, CREATE ON SCHEMA public TO postgres;
GRANT USAGE, CREATE ON SCHEMA public TO admin;
CREATE DATABASE mydb;
GRANT ALL ON DATABASE mydb TO admin;
privileges:
postgres=# \dn+
List of schemas
Name | Owner | Access privileges | Description
--------+----------+----------------------+------------------------
public | postgres | postgres=UC/postgres+| standard public schema
| | =UC/postgres +|
| | admin=UC/postgres |
(1 row)
what I got:
How to create tables in public schema?
PostgreSQL 15 also revokes the CREATE permission from all users except a database owner from the public (or default) schema
– Gride