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:
Nikhil Mohite authored and GitHub committed 2023-04-18 15:26:40 +05:30
1 parent e2c5d9a916
commit a6faa77e5b
1 file changed
+6 -1
@@ -12,7 +12,8 @@
"""
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):
@@ -25,6 +26,10 @@ def get_columns_types(is_query_tool, columns_info, table_oid, conn, has_oids):
)
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:
raise ExecuteError(rset)