title: Read-only access for Heroku Postgres Databases
body: <p>I have a Heroku Postgres database for my application. I can easily access the <code>psql</code> shell using the provided <code>DATABASE_URL</code> from Heroku</p>
  
  <pre><code>psql $(heroku config:get DATABASE_URL -a my_app)
  psql (9.6.1)
  SSL connection (protocol: TLSv1.2, cipher: ECDSE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
  Type "help" for help.
  
  d5i032ahpfiv07=&gt; 
  </code></pre>
  
  <p>And by default, this user seems to have full access to update and drop tables</p>
  
  <pre><code>d5i032ahpfiv07=&gt; SELECT 
    table_name, 
    string_agg(privilege_type, ', ') as privileges
  FROM information_schema.role_table_grants 
  WHERE table_schema = 'public'
    AND grantee = current_user
  GROUP BY 1
  ;
  
              table_name             |                          privileges
  -----------------------------------+---------------------------------------------------------------
   articles                          | INSERT, TRIGGER, REFERENCES, TRUNCATE, DELETE, UPDATE, SELECT
   comment_flags                     | TRIGGER, INSERT, SELECT, UPDATE, DELETE, TRUNCATE, REFERENCES
   comment_likes                     | TRUNCATE, REFERENCES, TRIGGER, INSERT, SELECT, UPDATE, DELETE
   comments                          | INSERT, SELECT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER
   communities                       | TRIGGER, REFERENCES, TRUNCATE, DELETE, UPDATE, SELECT, INSERT
   .....
  </code></pre>
  
  <p>I'd love to set up "Read Only" users in the database so that people can view this data without fear of running "DROP TABLE" or some other destructive command.</p>
  
  <p>How can I go about setting up a read-only user on Heroku Postgres? </p>
  
  <p>Thank you!</p>