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).
This commit is contained in:
Khushboo Vashi
2019-01-04 14:45:28 +00:00
committed by Dave Page
parent fb02f8b1be
commit ce1c06d7f1
2 changed files with 18 additions and 17 deletions

View File

@@ -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