CREATE USER POSTGRES_RO_USER
    NOSUPERUSER
    NOCREATEDB
    NOCREATEROLE
    LOGIN
    ENCRYPTED PASSWORD 'POSTGRES_RO_PASSWORD';

REVOKE ALL ON DATABASE POSTGRES_DB FROM POSTGRES_RO_USER;
GRANT CONNECT ON DATABASE POSTGRES_DB TO POSTGRES_RO_USER;

REVOKE ALL ON SCHEMA public FROM POSTGRES_RO_USER;
GRANT USAGE ON SCHEMA public TO POSTGRES_RO_USER;

GRANT SELECT ON ALL TABLES IN SCHEMA public TO POSTGRES_RO_USER;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO POSTGRES_RO_USER;
