I have to create a table in Postgres public schema for Airflow implementation. When I create a table with airflow user I get this error
permission denied for schema public
LINE 1: CREATE TABLE public.PERSONS(
if I run in psql
\dn+ public
I get
List of schemas
Name | Owner | Access privileges | Description
--------+-------------------+----------------------------------------+------------------------
public | pg_database_owner | pg_database_owner=UC/pg_database_owner+| standard public schema
| | =U/pg_database_owner +|
| | airflow=UC/pg_database_owner |
(1 row)
At this stage, I am not understanding what privileges I might be missing for the user after running
CREATE USER airflow PASSWORD
GRANT USAGE ON SCHEMA public TO airflow
GRANT ALL ON SCHEMA public TO airflow
select current_user, session_user;in the session you do theCREATE TABLE.PUBLICrole and that was what allowed your user to create objects in thepublicschema. Now(15+) you have to specifically add theCREATEprivilege for a role/user. What is confusing is that thisairflow=UC/pg_database_ownershows that privilege(C) granted. For more information see Privileges.