Re: Is pgAdmin the only front-end to PostgreSQL debugger ? And is "a working pl/pgsql debugger" something core should care to maintain ? - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: Is pgAdmin the only front-end to PostgreSQL debugger ? And is "a working pl/pgsql debugger" something core should care to maintain ?
Date
Msg-id CAFj8pRBZXYRtewge2G0VUwwN8j4QToLEa5fKsFQfJEWW1x-e_Q@mail.gmail.com
Whole thread Raw
In response to Is pgAdmin the only front-end to PostgreSQL debugger ? And is "a working pl/pgsql debugger" something core should care to maintain ?  (Hannu Krosing <hannuk@google.com>)
Responses Re: Is pgAdmin the only front-end to PostgreSQL debugger ? And is "a working pl/pgsql debugger" something core should care to maintain ?
List pgsql-hackers
Hi

čt 13. 2. 2025 v 18:00 odesílatel Hannu Krosing <hannuk@google.com> napsal:
Hallo PostgreSQL Hackers,


We recently discovered an error where pgAdmin fails when stepping into
nested function calls (
https://github.com/pgadmin-org/pgadmin4/issues/8443 ).

So while waiting for this to be fixed I would want to know if there
are other debugger front-ends that could be used to do basic debugging
of pl/pgsql code ?

If I remember, there was a independent application that was a plpgsql debugger, but it was in time before pgadmin 4

Maybe dbeaver uses it too. I think some commercial gui has support for debugging plpgsql, but I am not sure that it is.
 

And would these need a separate debugging extension, or is "debugging"
meant to be a generic PostgreSQL server feature that has a
well-defined API ?

Unfortunately  buildin API has not external interface. So everytime you need an extension that use internal plpgsql debug API or allow a access to some plpgsql data like stack or variables.

These extensions can be different, - plpgsql_check uses these API, plprofiler or pldebugger

If I remember well, the development of pldebugger or plprofiler was a fully independent project on Postgres core, and there was not any attempt to merge it upstream.

The internal buildin part is really minimalistic - just few hooks


I know there used to be another debugger as part of OmniDB which had
its own server-side extension as well, but wanted to know what is the
general thinking on this.

Is debugging pl/pgsq a generic feature of PostgreSQL core considering
that pl/pgsql itself kind of is ?

debugging plpgsql is independent of the PostgreSQL core.


Should there be something similar for debugging plain SQL and possibly
other PL languages?

I can imagine this - there can be some common API supported by language handlers.
 

Should there perhaps be debugging support in psql ?

psql does not support asynchronous API, so the implementation in psql really should not be simple. Moreover, I doubt that users want to use a debugger with a GUI similar to gdb. And it isn't possible to design a better UI directly in psql. I can imagine supporting some external debuggers executed inside / or outside the same terminal that communicates with psql by some bidirect pipe (psql will be used like a proxy).  Then can be designed some application similar to Borland debugger. This can be a very nice feature with probably not too much code, but handling bidirect pipes isn't trivial. Tuning reading from pipe for pspg for some less usual patterns was not nice work (and there the communication is significantly more simple than for debugger).

Regards

Pavel

------
Hannu


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg17.3 PQescapeIdentifier() ignores len
Next
From: Ranier Vilela
Date:
Subject: Re: pg17.3 PQescapeIdentifier() ignores len