mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-21 16:27:39 -06:00
Ensure we capture notices raised by queries. Fixes #3027
This commit is contained in:
parent
4d69764869
commit
25647c16ba
@ -760,6 +760,14 @@ def poll(trans_id):
|
||||
status, result = conn.poll(
|
||||
formatted_exception_msg=True, no_result=True)
|
||||
if not status:
|
||||
messages = conn.messages()
|
||||
if messages and len(messages) > 0:
|
||||
additional_messages = ''.join(messages)
|
||||
result = '{0}\n{1}\n\n{2}'.format(
|
||||
additional_messages,
|
||||
gettext('******* Error *******'),
|
||||
result
|
||||
)
|
||||
return internal_server_error(result)
|
||||
elif status == ASYNC_OK:
|
||||
status = 'Success'
|
||||
@ -800,10 +808,11 @@ def poll(trans_id):
|
||||
conn.manager.version
|
||||
)
|
||||
|
||||
SQL = render_template("/".join([template_path,
|
||||
'nodes.sql']),
|
||||
tid=command_obj.obj_id,
|
||||
has_oids=True)
|
||||
SQL = render_template(
|
||||
"/".join([template_path,'nodes.sql']),
|
||||
tid=command_obj.obj_id,
|
||||
has_oids=True
|
||||
)
|
||||
# rows with attribute not_null
|
||||
colst, rset = conn.execute_2darray(SQL)
|
||||
if not colst:
|
||||
@ -973,7 +982,8 @@ def fetch(trans_id, fetch_all=None):
|
||||
|
||||
return make_json_response(
|
||||
data={
|
||||
'status': status, 'result': result,
|
||||
'status': status,
|
||||
'result': result,
|
||||
'has_more_rows': has_more_rows,
|
||||
'rows_fetched_from': rows_fetched_from,
|
||||
'rows_fetched_to': rows_fetched_to
|
||||
|
@ -1333,6 +1333,7 @@ Failed to reset the connection to the server due to following error:
|
||||
)
|
||||
)
|
||||
|
||||
is_error = False
|
||||
try:
|
||||
status = self._wait_timeout(self.conn)
|
||||
except psycopg2.Error as pe:
|
||||
@ -1343,12 +1344,18 @@ Failed to reset the connection to the server due to following error:
|
||||
self.conn_id[5:]
|
||||
)
|
||||
errmsg = self._formatted_exception_msg(pe, formatted_exception_msg)
|
||||
return False, errmsg
|
||||
is_error = True
|
||||
|
||||
if self.conn.notices and self.__notices is not None:
|
||||
while self.conn.notices:
|
||||
self.__notices.append(self.conn.notices.pop(0)[:])
|
||||
|
||||
# We also need to fetch notices before we return from function in case
|
||||
# of any Exception, To avoid code duplication we will return after
|
||||
# fetching the notices in case of any Exception
|
||||
if is_error:
|
||||
return False, errmsg
|
||||
|
||||
result = None
|
||||
self.row_count = 0
|
||||
self.column_info = None
|
||||
|
Loading…
Reference in New Issue
Block a user