pldbgapi
pldbgapi
pldebugger : server-side support for debugging PL/pgSQL functions
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 3050 | pldbgapi | pldebugger | 1.9 | LANG | Artistic | 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 plpgsql pgtap pg_stat_statements plv8 plperl plpython3u |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG | 1.9 | 18 17 16 15 14 | pldebugger | - |
| RPM | PGDG | 1.9 | 18 17 16 15 14 | pldebugger_$v | - |
| DEB | PGDG | 1.9 | 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.9 | PGDG 1.8 | PGDG 1.8 | PGDG 1.8 | PGDG 1.8 |
el9.aarch64 | PGDG 1.9 | PGDG 1.8 | PGDG 1.8 | PGDG 1.8 | PGDG 1.8 |
el10.x86_64 | PGDG 1.9 | PGDG 1.8 | PGDG 1.8 | PGDG 1.8 | PGDG 1.8 |
el10.aarch64 | PGDG 1.9 | PGDG 1.8 | PGDG 1.8 | PGDG 1.8 | PGDG 1.8 |
d12.x86_64 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 |
d12.aarch64 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 |
d13.x86_64 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 |
d13.aarch64 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 |
u22.x86_64 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 |
u22.aarch64 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 |
u24.x86_64 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 |
u24.aarch64 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 | PGDG 1.9 |
Source
Install
Make sure PGDG repo available:
pig repo add pgdg -u # add pgdg repo and update cacheInstall this extension with pig:
pig install pldebugger; # install via package name, for the active PG version
pig install pldbgapi; # install by extension name, for the current active PG version
pig install pldbgapi -v 18; # install for PG 18
pig install pldbgapi -v 17; # install for PG 17
pig install pldbgapi -v 16; # install for PG 16
pig install pldbgapi -v 15; # install for PG 15
pig install pldbgapi -v 14; # install for PG 14Config this extension to shared_preload_libraries:
shared_preload_libraries = 'pldbgapi';Create this extension with:
CREATE EXTENSION pldbgapi;Usage
pldbgapi: server-side support for debugging PL/pgSQL functions
pldbgapi provides a server-side API for interactive debugging of PL/pgSQL functions. It is typically used through a GUI client such as pgAdmin.
CREATE EXTENSION pldbgapi;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.
Last updated on