PolarDB O Edition supports multiple stored procedure languages (SPLs) such as PL/pgSQL, PL/Python, PL/Perl, PL/Tcl, and PL/Java. You can use these SPLs to create functions or stored procedures. PolarDB provides the pldebugger plug-in to debug stored procedures.
PolarDB limits the maximum number of connections to the pldebugger plug-in. Each cluster can have up to three connections to the pldebugger plug-in. If your cluster must have more than three connections to the pldebugger plug-in, Submit a ticket.
For example, if you need to initiate a fourth connection between your cluster and pldebugger, submit a ticket to ask after-sales personnel to close one of the existing three connections.
Create and debug the plug-in as the polar_superuser user.
postgres=# CREATE EXTENSION if not exists pldbgapi; CREATE EXTENSION
- Use pgAdmin 4 to connect to the PolarDB cluster. For more information, see Connect to a PolarDB cluster.
- Find the function to be debugged, right-click the function, and choose .
- Use the pldebugger plug-in in pgAdmin 4.
- In the function debugging section on the right of the pgAdmin 4 page, you can perform
step-by-step operations to debug the function, such as
continue, set breakpoints, and stop.
- At the bottom of the pgAdmin 4 page, you can view the local variables, debugging results, and function stacks during the debugging.
- In the function debugging section on the right of the pgAdmin 4 page, you can perform step-by-step operations to debug the function, such as
Monitor connections to pldebugger
PolarDB allows you to monitor the connections to pldebugger. You can use the following function to query the number of existing connections and the default maximum number of connections to pldebugger:
postgres=# select * from polar_monitor_pldebugger_count(); current_connection | max_connection --------------------+---------------- 6 | 6 (1 row)
current_connection: the number of existing connections.
max_connection: the default maximum number of connections.
The preceding output shows that the number of existing connections to pldebugger is 6. Each pldebugger debugging process requires two connections. Therefore, three debugging processes exist in the preceding example. A maximum of three pldebugger processes are allowed.