From a6ed7422370eb315564fadb7be59b6969baa796e Mon Sep 17 00:00:00 2001 From: yoonghm Date: Sun, 27 Sep 2015 13:56:29 +0800 Subject: [PATCH] Clear previously left-over PQresult before calling pg_get_result() Bug: T52091 Change-Id: Iaa1a479b5eefcae0fc8f82b1d20e9575d609c0e9 --- includes/db/DatabasePostgres.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index c9d7b35c53..64ae1c6c61 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -395,6 +395,9 @@ class DatabasePostgres extends Database { if ( function_exists( 'mb_convert_encoding' ) ) { $sql = mb_convert_encoding( $sql, 'UTF-8' ); } + // Clear previously left over PQresult + while ( $res = pg_get_result( $this->mConn ) ) + pg_free_result( $res ); if ( pg_send_query( $this->mConn, $sql ) === false ) { throw new DBUnexpectedError( $this, "Unable to post new query to PostgreSQL\n" ); } -- 2.20.1