From ce1c06d7f1e525f7eba5245a3f62e54547f4134f Mon Sep 17 00:00:00 2001 From: Khushboo Vashi Date: Fri, 4 Jan 2019 14:45:28 +0000 Subject: [PATCH] Ensure we display the relation name (and not the OID) in the locks table wherever possible. Fixes #3702 Note that at the server level we fetch the data from pg_locks in the maintenance database, so it can not fetch the pg_class relation for tables in other databasess (relation::regclass). --- docs/en_US/release_notes_3_7.rst | 1 + web/pgadmin/dashboard/__init__.py | 34 +++++++++++++++---------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/docs/en_US/release_notes_3_7.rst b/docs/en_US/release_notes_3_7.rst index 77faf1c75..ee566f4b8 100644 --- a/docs/en_US/release_notes_3_7.rst +++ b/docs/en_US/release_notes_3_7.rst @@ -25,6 +25,7 @@ Bug fixes | `Bug #3599 `_ - Run Postfix in the container build so passwords can be reset etc. | `Bug #3619 `_ - Add titles to the code areas of the Query Tool and Debugger to ensure that panels can be re-docked within them. | `Bug #3679 `_ - Fix a webpack issue that could cause the Query Tool to fail to render. +| `Bug #3702 `_ - Ensure we display the relation name (and not the OID) in the locks table wherever possible. | `Bug #3711 `_ - Fix an encoding issue in the query tool. | `Bug #3726 `_ - Include the WHERE clause on EXCLUDE constraints in RE-SQL. | `Bug #3753 `_ - Fix an issue when user define Cast from smallint->text is created. diff --git a/web/pgadmin/dashboard/__init__.py b/web/pgadmin/dashboard/__init__.py index 5d14fa7d6..9a0118c80 100644 --- a/web/pgadmin/dashboard/__init__.py +++ b/web/pgadmin/dashboard/__init__.py @@ -219,25 +219,10 @@ def check_precondition(f): " to view the graph.") ) - g.conn = g.manager.connection() - - # If DB not connected then return error to browser - if not g.conn.connected(): - if f.__name__ in stats_type: - return precondition_required( - gettext("Please connect to the selected server" - " to view the table.") - ) - else: - return precondition_required( - gettext("Please connect to the selected server" - " to view the graph.") - ) - if 'did' in kwargs: - db_conn = g.manager.connection(did=kwargs['did']) + g.conn = g.manager.connection(did=kwargs['did']) # If the selected DB not connected then return error to browser - if not db_conn.connected(): + if not g.conn.connected(): if f.__name__ in stats_type: return precondition_required( gettext("Please connect to the selected database" @@ -248,6 +233,21 @@ def check_precondition(f): gettext("Please connect to the selected database to" " view the graph.") ) + else: + g.conn = g.manager.connection() + + # If DB not connected then return error to browser + if not g.conn.connected(): + if f.__name__ in stats_type: + return precondition_required( + gettext("Please connect to the selected server" + " to view the table.") + ) + else: + return precondition_required( + gettext("Please connect to the selected server" + " to view the graph.") + ) # Set template path for sql scripts g.server_type = g.manager.server_type