PolarDB for PostgreSQL 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.
Prerequisites
Considerations
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 pldebugger
Create and debug the plug-in as the polar_superuser user.
postgres=# CREATE EXTENSION if not exists pldbgapi;
CREATE EXTENSION
Use pldebugger
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.