title: PREPARE TRANSACTION releasing locks?
body: <p>I must be missing something about PostgreSQL and two phase commit with PREPARE TRANSACTION.</p>
  
  <p>The following SQL :</p>
  
  <pre><code>BEGIN; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
  UPDATE person.tcities set ctyname='L ABERGEMENT CLEMENCIAT TRANSACT' WHERE ctyid = 1
  </code></pre>
  
  <p>Gives the follwing locks :</p>
  
  <pre><code>4092    Private 329373  acc     15/53295    RowExclusiveLock    Oui 2013-06-13 18:15:55+02  UPDATE person.tcities set ctyname='L ABERGEMENT CLEMENCIAT TRANSACT' WHERE ctyid = 1    
  4092    Private 329369  acc     15/53295    RowExclusiveLock    Oui 2013-06-13 18:15:55+02  UPDATE person.tcities set ctyname='L ABERGEMENT CLEMENCIAT TRANSACT' WHERE ctyid = 1    
  4092    Private 328704  acc     15/53295    RowExclusiveLock    Oui 2013-06-13 18:15:55+02  UPDATE person.tcities set ctyname='L ABERGEMENT CLEMENCIAT TRANSACT' WHERE ctyid = 1    
  4092    Private 327169  acc     15/53295    RowExclusiveLock    Oui 2013-06-13 18:15:55+02  UPDATE person.tcities set ctyname='L ABERGEMENT CLEMENCIAT TRANSACT' WHERE ctyid = 1    
  4092            acc 15/53295    15/53295    ExclusiveLock   Oui 2013-06-13 18:15:55+02  UPDATE person.tcities set ctyname='L ABERGEMENT CLEMENCIAT TRANSACT' WHERE ctyid = 1    
  4092    Private 329377  acc     15/53295    RowExclusiveLock    Oui 2013-06-13 18:15:55+02  UPDATE person.tcities set ctyname='L ABERGEMENT CLEMENCIAT TRANSACT' WHERE ctyid = 1    
  4092            acc     15/53295    ExclusiveLock   Oui 2013-06-13 18:15:55+02  UPDATE person.tcities set ctyname='L ABERGEMENT CLEMENCIAT TRANSACT' WHERE ctyid = 1
  </code></pre>
  
  <p>As soon as the transaction is prepared :</p>
  
  <pre><code>PREPARE TRANSACTION 'TEST'
  </code></pre>
  
  <p>the lock are gone.</p>
  
  <p>Because there is small delay that occurs between PREPARE and COMMIT, another query could get an older version of the record.</p>
  
  <p>Is there a configuration setting to avoid this behavior or is it by design ?</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>EDIT</strong> : I'm using PostgreSQL 9.2.2 on Windows x64 (PostgreSQL 9.2.2, compiled by Visual C++ build 1600, 64-bit)</p>
  
  <p><strong>EDIT 2</strong> : Following is the full test case :</p>
  
  <p>Issue the following in new session :</p>
  
  <pre><code>BEGIN; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
  UPDATE person.tcities set ctyname='L ABERGEMENT CLEMENCIAT TRANSACT' WHERE ctyid = 1
  PREPARE TRANSACTION 'TEST';
  </code></pre>
  
  <p>Then in another new session :</p>
  
  <pre><code>SELECT * FROM person.tcities
  </code></pre>
  
  <p>You'll get the old version of the records.</p>