All Products
Search
Document Center

PolarDB:pldebugger

Last Updated:Mar 28, 2026

The pldebugger extension lets you debug functions and stored procedures written in PL/pgSQL, PL/Python, PL/Perl, PL/Tcl, and PL/Java directly in pgAdmin 4.

Prerequisites

Before you begin, make sure you have:

  • pgAdmin 4 v4.19 or later. Download from pgAdmin 4

  • A PolarDB cluster that you can connect to. See

Connection limits

Each PolarDB cluster allows up to three simultaneous pldebugger connections by default. Because each debugging session uses two connections, this default supports up to three concurrent debugging sessions.

If you need more than three connections, go to Quota Center and click Apply in the Actions column for PolarDB PG pldebugger plug-in use.

If you have reached the limit and need to start a new session, close one of the existing sessions first.

Enable the pldebugger extension

Run the following command as the polar_superuser user:

postgres=# CREATE EXTENSION if not exists pldbgapi;
CREATE EXTENSION

Debug a function

  1. Open pgAdmin 4 and connect to your PolarDB cluster.

  2. In the object tree, find the function to debug. Right-click the function and choose Debugging > Debug.

    Use pldebugger - 1

  3. The pldebugger interface opens on the right side of the pgAdmin 4 page.

    Use pldebugger - 2

Toolbar actions — Use the toolbar on the right panel to control execution:

ActionDescription
Step intoExecute the current line. If the line calls a sub-function, step into that function.
Step overExecute the current line. If the line calls a sub-function, the sub-function runs without being debugged.
ContinueResume execution until the next breakpoint or until the function completes.
Set breakpointPause execution at a specific line each time it is reached.
StopHalt execution immediately.

Bottom panel tabs — View runtime information during the debugging session:

TabShows
Local variablesValues of variables declared in the function
ResultsReturn values from the function
StackThe call stack at the current point of execution

Monitor pldebugger connections

Use polar_monitor_pldebugger_count() to check how many connections are currently active:

postgres=# select * from polar_monitor_pldebugger_count();
 current_connection | max_connection
--------------------+----------------
                  6 |              6
(1 row)
ColumnDescription
current_connectionNumber of active connections to pldebugger
max_connectionMaximum number of connections allowed

In the example above, current_connection is 6. Because each debugging session uses two connections, this means three debugging sessions are currently running — the default maximum.