From fb07fad34a73179278df6e79108ce09548c5c7b5 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Thu, 18 Apr 2013 02:29:51 +0100 Subject: [PATCH] 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. --- bin/pg_repack.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/pg_repack.c b/bin/pg_repack.c index d2f6575..a656e1c 100644 --- a/bin/pg_repack.c +++ b/bin/pg_repack.c @@ -1253,6 +1253,10 @@ cleanup: if (vxid) free(vxid); + /* Rollback current transactions */ + pgut_rollback(connection); + pgut_rollback(conn2); + /* XXX: distinguish between fatal and non-fatal errors via the first * arg to repack_cleanup(). */ @@ -1491,10 +1495,6 @@ repack_cleanup(bool fatal, const repack_table *table) char buffer[12]; const char *params[1]; - /* Rollback current transactions */ - pgut_rollback(connection); - pgut_rollback(conn2); - /* Try reconnection if not available. */ if (PQstatus(connection) != CONNECTION_OK || PQstatus(conn2) != CONNECTION_OK)