]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Allow multiple commands in _exec_command()
authorDaniel Fortunov <github@danielfortunov.com>
Thu, 6 Aug 2020 23:09:30 +0000 (00:09 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 26 Oct 2020 16:51:47 +0000 (17:51 +0100)
psycopg3/psycopg3/connection.py

index 67f9df4c1325bd41844a3b66240629e266f40ed0..19231c0564f0f061373b83648e10958c44a3401a 100644 (file)
@@ -279,11 +279,11 @@ class Connection(BaseConnection):
             return
 
         self.pgconn.send_query(command)
-        (pgres,) = self.wait(execute(self.pgconn))
-        if pgres.status != ExecStatus.COMMAND_OK:
+        results = self.wait(execute(self.pgconn))
+        if results[-1].status != ExecStatus.COMMAND_OK:
             raise e.OperationalError(
                 f"error on {command.decode('utf8')}:"
-                f" {pq.error_message(pgres, encoding=self.codec.name)}"
+                f" {pq.error_message(results[-1], encoding=self.codec.name)}"
             )
 
     @classmethod