postgres create a read only user code example
Example: grant read only privileges postgres user
grant connect on database "mydatabase" to "user";
GRANT USAGE ON SCHEMA public TO "user";
GRANT SELECT ON ALL TABLES IN SCHEMA "public" TO "user";
ALTER DEFAULT PRIVILEGES IN SCHEMA "public"
GRANT SELECT ON TABLES TO "user";