Since we are not starting a new transaction in conn2 during the swap step, we need to make sure that if our LOCK query is canceled due to statement_timeout that conn2's transaction is not left in a useless error state. Use SAVEPOINT and ROLLBACK TO SAVEPOINT to avoid this problem.