Skip to content

Commit fb07fad

Browse files
committed
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.
1 parent 477fba8 commit fb07fad

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bin/pg_repack.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,6 +1253,10 @@ repack_one_table(const repack_table *table, const char *orderby)
12531253
if (vxid)
12541254
free(vxid);
12551255

1256+
/* Rollback current transactions */
1257+
pgut_rollback(connection);
1258+
pgut_rollback(conn2);
1259+
12561260
/* XXX: distinguish between fatal and non-fatal errors via the first
12571261
* arg to repack_cleanup().
12581262
*/
@@ -1491,10 +1495,6 @@ repack_cleanup(bool fatal, const repack_table *table)
14911495
char buffer[12];
14921496
const char *params[1];
14931497

1494-
/* Rollback current transactions */
1495-
pgut_rollback(connection);
1496-
pgut_rollback(conn2);
1497-
14981498
/* Try reconnection if not available. */
14991499
if (PQstatus(connection) != CONNECTION_OK ||
15001500
PQstatus(conn2) != CONNECTION_OK)

0 commit comments

Comments
 (0)