microsoft / microsoft/vscode-pgsql
[Feature Request]: Integrate PL/pgSQL Debugger (pldebugger) with GUI similar to pgAdmin/DBeaver
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 395
- Forks
- 33
- Avg merge
- 1h 46m
- Merged PRs (30d)
- 3
Description
Feature Description
Currently, the vscode-pgsql extension is excellent for query execution, schema browsing, and visualization. However, when it comes to debugging stored procedures and functions written in PL/pgSQL, developers have to switch to external tools like pgAdmin or DBeaver.
The current workflow for debugging in VS Code is non-existent. Debugging server-side logic requires a separate, heavy IDE, which breaks the development flow. Developers want to set breakpoints, step into functions, and inspect variables directly inside VS Code without leaving the editor.
Proposed Capabilities
I propose the integration of the pldebugger extension into the vscode-pgsql workflow, accompanied by a native graphical interface.
The implementation should automate or simplify the following setup steps that are currently manual.
- OS-Level Package Installation: First, the pldebugger shared library must be installed on the PostgreSQL server machine. The installation method varies significantly by operating system:
- Ubuntu/Debian:
sudo apt install postgresql-<version>-pldebugger(e.g.,postgresql-16-pldebugger) - RHEL/Rocky/AlmaLinux:
sudo dnf install pldebugger_<version>(e.g.,pldebugger_16) - Windows: the debugger library (
plugin_debugger.dll) is bundled with the EnterpriseDB (EDB) PostgreSQL distribution, typically located in:C:\Program Files\PostgreSQL\<version>\lib\plugin_debugger.dll. If using the EDB installer, no additional OS-level installation is required - the library is present by default.
- PostgreSQL Server Configuration (
shared_preload_libraries):
The debugger library must be loaded at server startup. It cannot be added dynamically.
Required setting inpostgresql.conf.
- Check current setting by executing
SHOW shared_preload_libraries; - Detect the operating system and suggest the correct library path
- If
plugin_debuggeris not present:- Show a warning notification with platform-specific instructions
- Provide the correct postgresql.conf location for the detected OS
- Include the exact line to add to the configuration file
- Guide the user to restart PostgreSQL after configuration changes
- Provide a "Check Again" button after the user confirms the restart
- Server restart detection: Implement a way to detect if the server has been restarted after config changes (e.g., compare pg_postmaster_start_time before and after)
- Database Extension Creation
After the server restart, the debugger API must be enabled in the target database:CREATE EXTENSION pldbgapi;
Extension Behavior:
- Check if the extension already exists:
SELECT * FROM pg_extension WHERE extname = 'pldbgapi'; - If missing, display a prompt: "Debugger API is not installed in this database. Install now?"
- Provide an "Install" button that executes
CREATE EXTENSION pldbgapi;in the current connection. - Show a confirmation upon successful installation.
4. GUI Debugger Interface
Once all prerequisites are satisfied, provide a visual debugger within VS Code:
- Breakpoints: Set/remove breakpoints in .sql or .pgsql files, or directly in the function body editor.
- Debug Controls: Step Over, Step Into, Step Out, Continue, Stop.
- Variables Panel: Inspect local variables, parameters, and their values during execution.
- Call Stack: Show the current execution stack with navigation.
- Parameter Input: When debugging a function, prompt the user to enter parameter values (types, defaults, etc.).
- Output Panel: Display debug output, errors, and execution logs.
- Watch Expressions: Allow users to add custom expressions to monitor
The debugging experience should match the native VS Code Debugger UI (similar to Python, Node.js, or C# extensions), with a dedicated debug view and seamless integration.
Alternatives
- pgAdmin: While it has a functional debugger, it requires running a separate desktop application and a browser. It lacks the tight integration with the code editor that VS Code provides.
- DBeaver: Similar to pgAdmin, it is an external tool. It also relies on the same underlying pldebugger extension but offers a less modern UI compared to VS Code's native debugging experience.
Conclusion
Adding PL/pgSQL debugging with a complete cross-platform setup assistant and graphical interface would significantly enhance vscode-pgsql, making it the ultimate PostgreSQL development tool within VS Code. The three-layer setup (OS package → server config → database extension) is non-trivial, but with proper automation and platform-specific guidance, it becomes accessible to all developers, regardless of their operating system or deployment environment.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing vscode-pgsql workflow and the pldebugger prerequisites described in the issue: server installation, shared_preload_libraries, restart detection, and pldbgapi creation. Define the implementation scope before coding, since the request spans setup automation and a full VS Code debugger UI. Done should include verified prerequisite handling and breakpoint, stepping, variables, call stack, parameters, output, and watch functionality.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, vscode
- Domain
- databases, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100