Improve detection of the pldbgapi extension and functions before allowing debugging. Fixes #2026

pull/3/head
Neel Patel 2017-01-08 03:53:53 +00:00 committed by Dave Page
parent e3c8cb2706
commit a33ee2ae32
1 changed files with 11 additions and 3 deletions

View File

@ -203,10 +203,18 @@ def init_function(node_type, sid, did, scid, fid, trid=None):
status_in, rid_tar = conn.execute_scalar(
"SELECT count(*) FROM pg_proc WHERE proname = 'pldbg_get_target_info'")
if not status_in:
current_app.logger.debug("Failed to check for the pldbg_get_target_info function.")
return internal_server_error(gettext("Failed to check for the pldbg_get_target_info function."))
current_app.logger.debug("Failed to find the pldbgapi extension in this database.")
return internal_server_error(gettext("Failed to find the pldbgapi extension in this database."))
if rid_tar == 0:
#We also need to check to make sure that the debugger library is also available.
status_in, ret_oid = conn.execute_scalar(
"SELECT count(*) FROM pg_proc WHERE proname = 'plpgsql_oid_debug'")
if not status_in:
current_app.logger.debug("Failed to find the pldbgapi extension in this database.")
return internal_server_error(gettext("Failed to find the pldbgapi extension in this database."))
# Debugger plugin is configured but pldggapi extension is not created so return error
if rid_tar == '0' or ret_oid == '0':
msg = gettext("The debugger plugin is not enabled. Please create the pldbgapi extension in this database.")
ret_status = False
else: