Create Read Only User
suggest changeCREATE USER readonly WITH ENCRYPTED PASSWORD 'yourpassword';
GRANT CONNECT ON DATABASE <database_name> to readonly;
GRANT USAGE ON SCHEMA public to readonly;
GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO readonly;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readonly;
These grants apply only to tables and sequences that already exist in schema public. They do not cover objects created later, or objects in other schemas. See default privileges for future objects.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents