title: postgresql is SELECT FOR UPDATE over multiple rows atomic?
body: <p>Lets say that there are multiple parallel transactions that all do the same query:</p>
  
  <pre><code>SELECT * FROM table1 FOR UPDATE;
  </code></pre>
  
  <p>Can this result in a deadlock?</p>
  
  <p>To put it in another way. Is the operation "lock all rows" in the above statement atomic or are the locks acquired along the way while the the records are processed?</p>