diff --git a/web/pgadmin/utils/driver/psycopg2/connection.py b/web/pgadmin/utils/driver/psycopg2/connection.py index 4f11c12..0e77de5 100644 --- a/web/pgadmin/utils/driver/psycopg2/connection.py +++ b/web/pgadmin/utils/driver/psycopg2/connection.py @@ -1685,7 +1685,8 @@ Failed to reset the connection to the server due to following error: # if formatted_msg is false then return from the function if not formatted_msg: - return errmsg + notices = self.get_notices() + return errmsg if notices is '' else notices + '\n' + errmsg # Do not append if error starts with `ERROR:` as most pg related # error starts with `ERROR:` @@ -1748,7 +1749,8 @@ Failed to reset the connection to the server due to following error: errmsg += gettext('Context: ') errmsg += self.decode_to_utf8(exception_obj.diag.context) - return errmsg + notices = self.get_notices() + return errmsg if notices is '' else notices + '\n' + errmsg ##### # As per issue reported on pgsycopg2 github repository link is shared below @@ -1827,6 +1829,22 @@ Failed to reset the connection to the server due to following error: ] return notifies + def get_notices(self): + """ + This function will returns the notices as string. + :return: + """ + notices = '' + # Check for notices. + if self.conn.notices and self.__notices is not None: + self.__notices.extend(self.conn.notices) + self.conn.notices.clear() + + while self.__notices: + notices += self.__notices.pop(0) + + return notices + def pq_encrypt_password_conn(self, password, user): """ This function will return the encrypted password for database server