mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed issue in query tool where messages were not displaying from functions/procedures properly. Fixes #2555
This commit is contained in:
parent
bebfc62721
commit
ef48c2ed91
@ -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,
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user