title: How to create a user with readonly privileges for all databases in Postgresql?
body: <p>I want to create a user with only select privilege for all tables in all databases. I thought that I could get a list of databases and apply the following command for each database:</p>
  
  <pre><code>GRANT select ON DATABASE dbname to user1;
  </code></pre>
  
  <p>But I got the following error:</p>
  
  <pre><code>ERROR:  invalid privilege type SELECT for database
  </code></pre>
  
  <p>When I googled people advised to do the <code>grant select</code> operation for all tables. But new tables are being added always. So this is not an acceptable solution for me. Does anyone know any workarounds?</p>