From: Daniel Fortunov Date: Thu, 6 Aug 2020 23:09:30 +0000 (+0100) Subject: Allow multiple commands in _exec_command() X-Git-Tag: 3.0.dev0~449 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b94cb50a9295828912a6e36e5a33bb1f4ed1f87;p=thirdparty%2Fpsycopg.git Allow multiple commands in _exec_command() --- diff --git a/psycopg3/psycopg3/connection.py b/psycopg3/psycopg3/connection.py index 67f9df4c1..19231c056 100644 --- a/psycopg3/psycopg3/connection.py +++ b/psycopg3/psycopg3/connection.py @@ -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