Reset the transcation state before exiting from lock_exclusive.

Previously we exited from lock_exclusive() while opening the
transaction that started at beggning if --no-kill-backend option
is specified. This caused that DROP INDEX CONCURRENTLY fails
because it cannot be executed within a user transaction block.

Fixed issue #129.
This commit is contained in:
Masahiko Sawada 2017-08-18 15:13:20 +09:00
parent 1b651bd3d9
commit 900bb8369b

View File

@ -1780,7 +1780,12 @@ lock_exclusive(PGconn *conn, const char *relid, const char *lock_query, bool sta
{
elog(WARNING, "timed out, do not cancel conflicting backends");
ret = false;
pgut_rollback(conn);
/* Before exit the loop reset the transaction */
if (start_xact)
pgut_rollback(conn);
else
pgut_command(conn, "ROLLBACK TO SAVEPOINT repack_sp1", 0, NULL);
break;
}
else