mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Throw an appropriate error when a table for which View/Edit data is open is deleted and query is executed. #6138
This commit is contained in:
parent
e2c5d9a916
commit
a6faa77e5b
@ -12,7 +12,8 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
from pgadmin.utils.exception import ExecuteError
|
from flask_babel import gettext
|
||||||
|
from pgadmin.utils.exception import ExecuteError, ObjectGone
|
||||||
|
|
||||||
|
|
||||||
def get_columns_types(is_query_tool, columns_info, table_oid, conn, has_oids):
|
def get_columns_types(is_query_tool, columns_info, table_oid, conn, has_oids):
|
||||||
@ -25,6 +26,10 @@ def get_columns_types(is_query_tool, columns_info, table_oid, conn, has_oids):
|
|||||||
)
|
)
|
||||||
|
|
||||||
colst, rset = conn.execute_2darray(query)
|
colst, rset = conn.execute_2darray(query)
|
||||||
|
# If no record found consider table is deleted, raise error
|
||||||
|
if len(rset['rows']) == 0:
|
||||||
|
raise ObjectGone(gettext("The specified object could not be found."))
|
||||||
|
|
||||||
if not colst:
|
if not colst:
|
||||||
raise ExecuteError(rset)
|
raise ExecuteError(rset)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user