Make sure to close the transactions after repack_one_table

If we exit early (e.g. checking the triggers) repack_cleanup() is not called
but we must close the transactions anyway.
This commit is contained in:
Daniele Varrazzo 2013-04-18 02:29:51 +01:00
parent 477fba884c
commit fb07fad34a

View File

@ -1253,6 +1253,10 @@ cleanup:
if (vxid) if (vxid)
free(vxid); free(vxid);
/* Rollback current transactions */
pgut_rollback(connection);
pgut_rollback(conn2);
/* XXX: distinguish between fatal and non-fatal errors via the first /* XXX: distinguish between fatal and non-fatal errors via the first
* arg to repack_cleanup(). * arg to repack_cleanup().
*/ */
@ -1491,10 +1495,6 @@ repack_cleanup(bool fatal, const repack_table *table)
char buffer[12]; char buffer[12];
const char *params[1]; const char *params[1];
/* Rollback current transactions */
pgut_rollback(connection);
pgut_rollback(conn2);
/* Try reconnection if not available. */ /* Try reconnection if not available. */
if (PQstatus(connection) != CONNECTION_OK || if (PQstatus(connection) != CONNECTION_OK ||
PQstatus(conn2) != CONNECTION_OK) PQstatus(conn2) != CONNECTION_OK)