title: Does this query guarantee me a 'race free' PK value?
body: <p>I was just reading <a href="https://stackoverflow.com/questions/698366/how-to-avoid-a-database-race-condition-when-manually-incrementing-pk-of-new-row">How to avoid a database race condition when manually incrementing PK of new row.</a></p>
  
  <p>There was a lot of good suggestions like having a separate table to get the PK values.</p>
  
  <p>So I wonder if a query like this:</p>
  
  <pre><code>INSERT INTO Party VALUES(
      (SELECT MAX(id)+1 FROM 
          (SELECT id FROM Party) as x),
  'A-XXXXXXXX-X','Joseph')
  </code></pre>
  
  <p>could avoid race conditions?</p>
  
  <p>Is the whole statement guaranteed to be atomic? Isn't in mysql? postgresql?</p>