Thread: pl/SQL debugging in PostgreSQL

pl/SQL debugging in PostgreSQL

From
Michael Holzman
Date:
Hello,

I'm quite new to the pl/SQL development. I've got an Oracle stored procedure that needs to be ported to PG. My fist conversion attempt failed but I do not understand why. I need to debug this code to see what happens.

What are the ways of development and debugging of pl/SQL code in PG? Any suggestions/hints will be very appreciated.

--
Regards,
    Michael Holzman

Re: pl/SQL debugging in PostgreSQL

From
Tom Lane
Date:
Michael Holzman <michaelholzman@gmail.com> writes:
> What are the ways of development and debugging of pl/SQL code in PG? Any
> suggestions/hints will be very appreciated.

The standard low-tech way is to sprinkle RAISE NOTICE (or maybe RAISE LOG)
actions throughout your function.  The only real alternative I know about
is EDB's pl/debugger, which I think used to be available standalone but
these days it seems like they only provide it with the pgAdmin GUI.

https://www.pgadmin.org

            regards, tom lane


Re: pl/SQL debugging in PostgreSQL

From
Alvaro Herrera
Date:
On 2019-Jan-25, Tom Lane wrote:

> Michael Holzman <michaelholzman@gmail.com> writes:
> > What are the ways of development and debugging of pl/SQL code in PG? Any
> > suggestions/hints will be very appreciated.
> 
> The standard low-tech way is to sprinkle RAISE NOTICE (or maybe RAISE LOG)
> actions throughout your function.  The only real alternative I know about
> is EDB's pl/debugger, which I think used to be available standalone but
> these days it seems like they only provide it with the pgAdmin GUI.

There's also a plpgsql debugger in OmniDB:
https://omnidb.org/en/documentation-en/13-debug-plpgsql-functions-en

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services