Check debugger enabled or not, also check pldbgapi extension is present or not :param conn: :param ret_status: :return:
(conn, ret_status)
| 515 | |
| 516 | |
| 517 | def check_debugger_enabled(conn, ret_status): |
| 518 | """ |
| 519 | Check debugger enabled or not, also check pldbgapi extension is present |
| 520 | or not |
| 521 | :param conn: |
| 522 | :param ret_status: |
| 523 | :return: |
| 524 | """ |
| 525 | msg = '' |
| 526 | status_in, rid_tar = conn.execute_scalar( |
| 527 | "SELECT count(*) FROM pg_catalog.pg_proc WHERE " |
| 528 | "proname = 'pldbg_get_target_info'" |
| 529 | ) |
| 530 | if not status_in: |
| 531 | current_app.logger.debug( |
| 532 | "Failed to find the pldbgapi extension in this database.") |
| 533 | return True, internal_server_error( |
| 534 | gettext("Failed to find the pldbgapi extension in " |
| 535 | "this database.") |
| 536 | ), None, None |
| 537 | |
| 538 | # We also need to check to make sure that the debugger library is |
| 539 | # also available. |
| 540 | status_in, ret_oid = conn.execute_scalar( |
| 541 | "SELECT count(*) FROM pg_catalog.pg_proc WHERE " |
| 542 | "proname = 'plpgsql_oid_debug'" |
| 543 | ) |
| 544 | if not status_in: |
| 545 | current_app.logger.debug( |
| 546 | "Failed to find the pldbgapi extension in this database.") |
| 547 | return True, internal_server_error( |
| 548 | gettext("Failed to find the pldbgapi extension in " |
| 549 | "this database.") |
| 550 | ), None, None |
| 551 | |
| 552 | # Debugger plugin is configured but pldggapi extension is not |
| 553 | # created so return error |
| 554 | if rid_tar == '0' or ret_oid == '0': |
| 555 | msg = gettext( |
| 556 | "The debugger plugin is not enabled. Please create the " |
| 557 | "pldbgapi extension in this database." |
| 558 | ) |
| 559 | ret_status = False |
| 560 | return False, None, ret_status, msg |
| 561 | |
| 562 | |
| 563 | def check_user_ip_req(r_set, data): |
no test coverage detected