title: Suspend transaction in Postgres
body: <p>I have seen another database system that offers to suspend <a href="https://en.wikipedia.org/wiki/Database_transaction" rel="nofollow noreferrer">transaction</a>. The current transaction is kept intact but put on hold while your code is allowed to work with the database to effect immediate permanent changes to rows. Then you can resume transaction, continuing where you left off with the same locks and other transaction protections in place as if you'd never interrupted it.</p>
  
  <p>For example, say an customer is placing an order, in a transaction. During that transaction, the customer notices their phone number needs to be updated, so we change that data. Next, customer decides to cancel the not-yet-completed order. A rollback of the order has the unintended consequence of also undoing the phone number change. So it would be nice if we could:</p>
  
  <ol>
  <li>Suspend the transaction for the order.</li>
  <li>Update the phone number, committed to the database.</li>
  <li>Resume the transaction for the order.</li>
  </ol>
  
  <p>Is there some way to suspend a transaction in <a href="https://en.wikipedia.org/wiki/PostgreSQL" rel="nofollow noreferrer">Postgres</a>? In <a href="https://en.wikipedia.org/wiki/Java_Database_Connectivity" rel="nofollow noreferrer">JDBC</a>?</p>