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 2023-04-18 15:26:40 +05:30 committed by GitHub
parent e2c5d9a916
commit a6faa77e5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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