This is a CLI debugger for PL/pgSQL. It is in its early stages and rather
archaic. It does make use of the pldbgapi extension for PostgreSQL. You can
typically install it from the main PG repository.
- Checkout from GitHub
- Install requirements:
pip3 install -r requirements.txt - Ensure you have the
pldbgapiextension installed (it will warn you if not) - Start a debug session:
./run.py --dsn <dsn>. The<dsn>is the complete connection string to your running PostgreSQL instance. - Start to debug a PL/pgSQL function by calling
run <function call>(see below).
- Output could be prettier / more readable.
- Not everything tested.
- Error handling might be incomplete, it could bail out and leave connections open.
source,brsetcommands do not yet work with other functions than the active target functions. In other words: you can use them only on functions which do not call other functions respectively you can step into them but not show their source or set breakpoints.- Not all commands from
pldbgapiimplemented.
Currently, the following commands are available. There is no extensive syntax checking as of now, so you'll maybe run into trouble here and there.
run <function call>starts debugging, ensure that<function call>is complete with all arguments, i.e. likerun example_function_1(2).stopstops debugging.continuecauses the execution to proceed to the next breakpoint.varsdisplays all variables of the current frame.sistep-into, step into a function call, stop at the next executable instruction/breakpoint.sostep-over, step over a function call, stop at the next executable instruction/breakpoint.sourceshow the source of the current target function. Does not yet take into account that you could have nested functions.stackshow the current stack.brshowshow all active breakpoints.brset <line>set a breakpoint in the current target function at the given line. Caution: does not work with nested functions yet.exitexits the debugger.