pldbgapi
pldebugger : server-side support for debugging PL/pgSQL functions
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 3050 | pldbgapi | pldebugger | 1.10 |
LANG | Artistic-2.0 | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --sLd-r | No | Yes | Yes | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | plpgsql_check plprofiler pglinter pg_stat_plans auto_explain pg_stat_statements pg_show_plans pg_store_plans hypopg index_advisor |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG | 1.10 |
18 17 16 15 14 | pldebugger |
- |
| RPM | PGDG | 1.10 |
18 17 16 15 14 | pldebugger_$v |
- |
| DEB | PGDG | 1.10 |
18 17 16 15 14 | postgresql-$v-pldebugger |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PGDG 1.9 | PGDG 1.8 | PGDG 1.8 | PGDG 1.8 | PGDG 1.8 |
| el8.aarch64 | PGDG 1.9 | PGDG 1.8 | PGDG 1.8 | PGDG 1.8 | PGDG 1.8 |
| el9.x86_64 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 |
| el9.aarch64 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 |
| el10.x86_64 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 |
| el10.aarch64 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 |
| d12.x86_64 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 |
| d12.aarch64 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 |
| d13.x86_64 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 |
| d13.aarch64 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 |
| u22.x86_64 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 |
| u22.aarch64 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 |
| u24.x86_64 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 |
| u24.aarch64 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 |
| u26.x86_64 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 |
| u26.aarch64 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 | PGDG 1.10 |
Source
github.com/EnterpriseDB/pldebugger
Install
Make sure PGDG repo available:
Install this extension with pig:
Config this extension to shared_preload_libraries:
Create this extension with:
Usage
Sources: repo README, v1.10 release, extension control
pldbgapi provides a server-side API for interactive debugging of PL/pgSQL functions. It is typically used through a GUI client such as pgAdmin.
Debugging with pgAdmin
The primary way to use the debugger is through pgAdmin’s graphical interface:
- Direct Debugging: Right-click a function and select “Debug” to execute and step through it immediately
- Global Breakpoints: Select “Set Global Breakpoint” on a function, then wait for another session (e.g., a web application) to call that function – the debugger will intercept the call and allow in-context debugging
Debugging Capabilities
When connected through a debug client, you can:
- Set breakpoints on specific lines in PL/pgSQL functions
- Step through code line by line (step into, step over, step out)
- Inspect variables and their current values at each step
- View the call stack for nested function calls
- Continue execution to the next breakpoint
Architecture
The debugging system has three components:
- Client GUI (pgAdmin) – displays source code, variables, and stack
- Target Backend – the session executing the PL/pgSQL code being debugged
- Debugging Proxy – coordinates between the client and target via a dedicated connection
Supported Languages
The debugger works with PL/pgSQL functions and procedures. It requires the pldbgapi extension to be created in each database where debugging is needed.
Caveats
- The package name is
pldebugger, while the extension created in SQL ispldbgapi; the catalog tracks package version1.10for PostgreSQL 14 through 18. - The v1.10 upstream release is a PostgreSQL compatibility update and does not document a new user-facing SQL API or debugging workflow.
- Upstream troubleshooting says
shared_preload_libraries = '$libdir/plugin_debugger'must be configured and PostgreSQL restarted. Missing or incorrect preload prevents global breakpoints and can also preventpldbgapiSQL from loading on some platforms.