Hi,
PFA patch to fix the issue where in query tool, messages were not
displaying from functions/procedures properly.
RM#2555
Needs to be reviewed with (Success/Fail/Error scenarios):
1) Table output
2) Function output
3) Procedure output (EPAS)
4) Adhoc query output (like vacuum)
--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/tools/sqleditor/__init__.py
b/web/pgadmin/tools/sqleditor/__init__.py
index 2ffc74a..15ec8c4 100644
--- a/web/pgadmin/tools/sqleditor/__init__.py
+++ b/web/pgadmin/tools/sqleditor/__init__.py
@@ -528,7 +528,6 @@ def poll(trans_id):
rows_fetched_from = 0
rows_fetched_to = 0
has_more_rows = False
- additional_result = []
columns = dict()
columns_info = None
primary_keys = None
@@ -640,30 +639,23 @@ def poll(trans_id):
status = 'NotConnected'
result = error_msg
- # Procedure/Function output may comes in the form of Notices from the
- # database server, so we need to append those outputs with the
- # original result.
-
- if status == 'Success' and result is None:
- result = conn.status_message()
- messages = conn.messages()
- if messages:
- additional_result = ''.join(messages)
- else:
- additional_result = ''
- if result != 'SELECT 1' and result is not None:
- result = additional_result + result
- else:
- result = additional_result
-
# 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:
+ if status == 'Success':
messages = conn.messages()
if messages:
additional_messages = ''.join(messages)
+ # Procedure/Function output may comes in the form of Notices from the
+ # database server, so we need to append those outputs with the
+ # original result.
+ if status == 'Success' and result is None:
+ result = conn.status_message()
+ if (result != 'SELECT 1' or result != 'SELECT 0') \
+ and result is not None and additional_messages:
+ result = additional_messages + result
+
return make_json_response(
data={
'status': status, 'result': result,
diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
index 6452744..3e61f10 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
@@ -1889,14 +1889,13 @@ define('tools.querytool', [
var _msg = msg1 + '\n' + msg2;
- self.update_msg_history(true, _msg, false);
// 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);
+ self.update_msg_history(true, _msg, false);
/* Add the data to the collection and render the grid.
* In case of Explain draw the graph on explain panel
@@ -2080,7 +2079,7 @@ define('tools.querytool', [
$('.sql-editor-message').text(msg);
} else {
- $('.sql-editor-message').append(msg);
+ $('.sql-editor-message').append(_.escape(msg));
}
// Scroll automatically when msgs appends to element