diff --git a/docs/en_US/release_notes_3_6.rst b/docs/en_US/release_notes_3_6.rst index 53557033e..43155902c 100644 --- a/docs/en_US/release_notes_3_6.rst +++ b/docs/en_US/release_notes_3_6.rst @@ -15,5 +15,6 @@ Features Bug fixes ********* +| `Bug #3016 `_ - Ensure previous notices are not removed from the Messages tab in the Query Tool if an error occurs during query execution. | `Bug #3029 `_ - Allow the selection order to be preserved in the Select2 control to fix column ordering in data Import/Export. -| `Bug #3629 `_ - Allow use of 0 (integer) and empty strings as parameters in the debugger. \ No newline at end of file +| `Bug #3629 `_ - Allow use of 0 (integer) and empty strings as parameters in the debugger. diff --git a/web/pgadmin/utils/driver/psycopg2/connection.py b/web/pgadmin/utils/driver/psycopg2/connection.py index 4f11c12b3..0e77de5e1 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