From 6e68e7501a5743b549fff060be31df84e1545f7b Mon Sep 17 00:00:00 2001 From: Murtuza Zabuawala Date: Fri, 18 Nov 2016 13:53:57 +0000 Subject: [PATCH] Display messages and notices received in the query tool. Fixes #1953 --- web/pgadmin/tools/sqleditor/__init__.py | 11 ++++++++++- .../templates/sqleditor/js/sqleditor.js | 18 +++++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/web/pgadmin/tools/sqleditor/__init__.py b/web/pgadmin/tools/sqleditor/__init__.py index 8e7896704..4e1efd545 100644 --- a/web/pgadmin/tools/sqleditor/__init__.py +++ b/web/pgadmin/tools/sqleditor/__init__.py @@ -504,11 +504,20 @@ def poll(trans_id): rows_affected = conn.rows_affected() + # There may be additional messages even if result is present + # eg: Function can provide result as well as RAISE messages + additional_messages = None + if status == 'Success' and result is not None: + messages = conn.messages() + if messages: + additional_messages = ''.join(messages) + return make_json_response( data={ 'status': status, 'result': result, 'colinfo': col_info, 'primary_keys': primary_keys, - 'rows_affected': rows_affected + 'rows_affected': rows_affected, + 'additional_messages': additional_messages } ) diff --git a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js index 3f121c4d3..e2c7cad47 100644 --- a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js @@ -1787,12 +1787,20 @@ define( alertify.success(msg1 + '
' + msg2, self.info_notifier_timeout); } - $('.sql-editor-message').text(msg1 + '\n' + msg2); + var _msg = msg1 + '\n' + msg2; - /* Add the data to the collection and render the grid. - * In case of Explain draw the graph on explain panel - * and add json formatted data to collection and render. - */ + // If there is additional messages from server then add it to message + if(!_.isNull(data.additional_messages) && + !_.isUndefined(data.additional_messages)) { + _msg = data.additional_messages + '\n' + _msg; + } + + $('.sql-editor-message').text(_msg); + + /* Add the data to the collection and render the grid. + * In case of Explain draw the graph on explain panel + * and add json formatted data to collection and render. + */ var explain_data_array = []; if( data.result && data.result.length >= 1 &&