title: How to lock a SELECT in PostgreSQL?
body: <p>I am used to do this in MySQL:</p>
  
  <pre><code>INSERT INTO ... SELECT ...
  </code></pre>
  
  <p>which would lock the table I <code>SELECT</code> from.</p>
  
  <p>Now, I am trying to do something similar in PostgreSQL, where I select a set of rows in a table, and then I insert some stuff in other tables based on those rows values. I want to prevent having outdated data, so I am wondering how can I lock a <code>SELECT</code> in PostgresSQL.</p>