title: PostgreSQL: read only user
body: <p>We have a PostgreSQL database 'db1', which is having around 500 schemas.
  I am trying to create a read-only user for this particular PostgreSQL database.</p>
  
  <p>I successfully assigned read-only permission to a particular schema using the following command</p>
  
  <pre><code>GRANT SELECT ON ALL TABLES IN SCHEMA schema_name TO readonly_user;
  </code></pre>
  
  <p>but</p>
  
  <p>1) We have around 500 schemas, so granting permission to each schema is difficult.</p>
  
  <p>2) These schemas will be dynamically created or dropped on a daily basis, so giving permission at each time a schema is created is also a difficult task.</p>
  
  <p>Is there any way to give the read-only permission for a whole database instead of schema?</p>
  
  <p>In MySQL, I can do it by using the following command</p>
  
  <pre><code>grant select on *.* to 'user_name'@'IP';
  </code></pre>
  
  <p>I am looking for a similar command in PostgreSQL.</p>
  
  <p>We are using PostgreSQL 10.</p>