From 208eff3c2840886e9a0d8e76a1f31a9e5646449f Mon Sep 17 00:00:00 2001 From: Robert Treat Date: Sat, 20 Jul 2019 17:04:44 -0400 Subject: [PATCH] Fix bug with partial SQL execution failure. Fix based on patches from @nirgal and @LuckySB Reported at: https://sourceforge.net/p/phppgadmin/bugs/448/ https://bugs.debian.org/762378 https://github.com/phppgadmin/phppgadmin/pull/27 https://github.com/phppgadmin/phppgadmin/pull/30 --- classes/database/Postgres.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/classes/database/Postgres.php b/classes/database/Postgres.php index 466db5d1..ca649ec7 100644 --- a/classes/database/Postgres.php +++ b/classes/database/Postgres.php @@ -7538,12 +7538,15 @@ class Postgres extends ADODB_base { */ if (strlen($query_buf) > 0) $query_buf .= "\n"; - /* append the line to the query buffer */ - $query_buf .= $subline; + $query_buf .= $subline; + } $query_buf .= ';'; + /* is there anything in the query_buf? */ + if (trim($query_buf)) + { // Execute the query. PHP cannot execute - // empty queries, unlike libpq + // empty queries, unlike libpq $res = @pg_query($conn, $query_buf); // Call the callback function for display -- 2.39.5