From 3bb2c115b2e3d14b2de84114dbffc58f3b71fae5 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Wed, 6 Feb 2013 22:03:55 +0100 Subject: [PATCH] only rollback if transaction status indicates need of action --- src/php_pq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/php_pq.c b/src/php_pq.c index e298d2b..a465eed 100644 --- a/src/php_pq.c +++ b/src/php_pq.c @@ -1803,8 +1803,9 @@ static void php_pqconn_persistent_resource_factory_dtor(void *opaque, void *hand { PGresult *res; + /* clean up */ - if ((res = PQexec(handle, "ROLLBACK; RESET ALL;"))) { + if ((res = PQexec(handle, PQtransactionStatus(handle) == PQTRANS_IDLE ? "RESET ALL" : "ROLLBACK; RESET ALL"))) { PHP_PQclear(res); } -- 2.30.2