Is there any way to print out debug statements in Postgres PSQL?

postgresql, psql

Solution

You can use `RAISE NOTICE` like this:

RAISE NOTICE 'I got here:% is the new value', NEW.col;

A notice won't terminate execution, it is a kind of message that is sent to the client asynchronously.

Problem

I'm thinking something in the lines of `DBMS_OUTPUT.PUT_LINE` in Oracle, it allows you to trace what's going on in a stored procedure in the exactly same way you would use `printf`, `puts` or some other `STDIO` writing proc in a "normal" programming language, i.e. ``` DBMS_OUTPUT.PUT_LINE('I got here:'||:new.col||' is the new value'); ``` is there any way of doing this in Postgres? If not, what's the "community way" of doing this? Creating a table with a string row and inserting debug values there?

Original source

Related problems