Ensure command tags are shown in the messages tab of the Query Tool. Fixes #4520

This commit is contained in:
Yosry Muhammad 2019-08-01 14:29:38 +01:00 committed by Dave Page
parent 7b65507533
commit 76e658ee12
4 changed files with 16 additions and 14 deletions

View File

@ -26,4 +26,5 @@ Bug fixes
| `Issue #4496 <https://redmine.postgresql.org/issues/4496>`_ - Ensure columns can be created when they are IDENTITY fields with the CYCLE option enabled. | `Issue #4496 <https://redmine.postgresql.org/issues/4496>`_ - Ensure columns can be created when they are IDENTITY fields with the CYCLE option enabled.
| `Issue #4497 <https://redmine.postgresql.org/issues/4497>`_ - Ensure purely numeric comments can be saved on new columns. | `Issue #4497 <https://redmine.postgresql.org/issues/4497>`_ - Ensure purely numeric comments can be saved on new columns.
| `Issue #4508 <https://redmine.postgresql.org/issues/4508>`_ - Fix accessibility issue for Datetime cell in backgrid. | `Issue #4508 <https://redmine.postgresql.org/issues/4508>`_ - Fix accessibility issue for Datetime cell in backgrid.
| `Issue #4520 <https://redmine.postgresql.org/issues/4520>`_ - Ensure the query tool will work with older versions of psycopg2 than we officially support, albeit without updatable resultsets. | `Issue #4520 <https://redmine.postgresql.org/issues/4520>`_ - Ensure the query tool will work with older versions of psycopg2 than we officially support, albeit without updatable resultsets.
| `Issue #4525 <https://redmine.postgresql.org/issues/4525>`_ - Ensure command tags are shown in the messages tab of the Query Tool.

View File

@ -399,17 +399,6 @@ def poll(trans_id):
additional_messages = ''.join(messages) additional_messages = ''.join(messages)
notifies = conn.get_notifies() notifies = conn.get_notifies()
# 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 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
else:
result = None
if st: if st:
if 'primary_keys' in session_obj: if 'primary_keys' in session_obj:
primary_keys = session_obj['primary_keys'] primary_keys = session_obj['primary_keys']
@ -496,6 +485,7 @@ def poll(trans_id):
col_info['pgadmin_alias'] = \ col_info['pgadmin_alias'] = \
re.sub("[%()]+", "|", col_name) re.sub("[%()]+", "|", col_name)
session_obj['columns_info'] = columns session_obj['columns_info'] = columns
# status of async_fetchmany_2darray is True and result is none # status of async_fetchmany_2darray is True and result is none
# means nothing to fetch # means nothing to fetch
if result and rows_affected > -1: if result and rows_affected > -1:
@ -516,6 +506,17 @@ def poll(trans_id):
# restore it and update the session variable. # restore it and update the session variable.
update_session_grid_transaction(trans_id, session_obj) update_session_grid_transaction(trans_id, session_obj)
# 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 result is None:
result = conn.status_message()
if result is not None and additional_messages is not None:
result = additional_messages + result
else:
result = result if result is not None \
else additional_messages
elif status == ASYNC_EXECUTION_ABORTED: elif status == ASYNC_EXECUTION_ABORTED:
status = 'Cancel' status = 'Cancel'
else: else:

View File

@ -33,7 +33,7 @@ class TestViewData(BaseTestGenerator):
json_val json Not Null, json_val json Not Null,
Constraint table_pk Primary Key(id) Constraint table_pk Primary Key(id)
);""", );""",
result_data=None, result_data='SELECT 0',
rows_fetched_to=0 rows_fetched_to=0
) )
) )

View File

@ -251,7 +251,7 @@ class TestSaveChangedData(BaseTestGenerator):
}, },
save_status=True, save_status=True,
check_sql='SELECT * FROM %s WHERE pk_col = 2', check_sql='SELECT * FROM %s WHERE pk_col = 2',
check_result=None check_result='SELECT 0'
)), )),
] ]