PolarDB for PostgreSQL supports multiple stored procedure languages (SPLs), including PL/pgSQL, PL/Python, PL/Perl, PL/Tcl, and PL/Java. The pldebugger extension lets you debug functions and stored procedures written in these languages directly from pgAdmin 4.
Prerequisites
Before you begin, ensure that you have:
pgAdmin 4 v4.19 or later. Download it from pgadmin.org/download.
Connection limits
Each PolarDB for PostgreSQL cluster supports up to three concurrent debugging sessions. Each session uses two connections, so the cluster allows a maximum of six pldebugger connections at a time.
If you need more than three concurrent sessions, go to the Quota Center and click Apply in the Actions column for PolarDB PG pldebugger plug-in use.
If three sessions are already active and you need to start a new one, close one of the existing sessions first.
Create the pldebugger extension
Run the following command as a superuser:
CREATE EXTENSION IF NOT EXISTS pldbgapi;Debug a function
Connect pgAdmin 4 to your PolarDB for PostgreSQL cluster. For details, see .
In the object tree, find the function to debug. Right-click it and choose Debugging > Debug.

The debugger opens in the main panel.

In the function debugging section on the right, use the toolbar to control execution: step into/over, continue, set breakpoints, and stop.
At the bottom of the page, inspect local variables, debugging results, and function stacks during the debugging session.
Monitor connections
This function is supported only for PolarDB for PostgreSQL clusters running the PostgreSQL 11 database engine.
To check how many pldebugger connections are currently in use, run:
SELECT * FROM polar_monitor_pldebugger_count();Sample output:
current_connection | max_connection
--------------------+----------------
6 | 6
(1 row)| Column | Description |
|---|---|
current_connection | Number of active connections |
max_connection | Maximum number of allowed connections |
In this example, six connections are in use. Because each debugging session requires two connections, this means three sessions are active — the maximum allowed.