Read only user in postgres

The SQL snippet to create read-only user in postgresql database. The user have read access on existing tables and tables created in the future.

What is more, the user can create new tables and do inserts into these tables.

The gist is based on:

  • https://gist.github.com/oinopion/4a207726edba8b99fd0be31cb28124d0
  • https://tableplus.io/blog/2018/04/postgresql-how-to-create-read-only-user.html

Written on April 4, 2019