From 415e9c0ac58d14427031dea11fdaca518f4489d7 Mon Sep 17 00:00:00 2001 From: Aditya Toshniwal Date: Mon, 3 Apr 2023 16:07:34 +0530 Subject: [PATCH] Ensure that when execute_scalar is run for multiple queries in single SQL then the last query result is returned. --- web/pgadmin/utils/driver/psycopg3/connection.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/pgadmin/utils/driver/psycopg3/connection.py b/web/pgadmin/utils/driver/psycopg3/connection.py index afd478260..84dd20a77 100644 --- a/web/pgadmin/utils/driver/psycopg3/connection.py +++ b/web/pgadmin/utils/driver/psycopg3/connection.py @@ -987,6 +987,11 @@ WHERE db.datname = current_database()""") except Exception: print("EXCEPTION.....") + # If multiple queries are run, make sure to reach + # the last query result + while cur.nextset(): + pass + self.row_count = cur.get_rowcount() if cur.get_rowcount() > 0: res = cur.fetchone()