Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 204
bbozo Avatar asked May 04 '17 19:05

bbozo


Video Answer


1 Answers

You can use RAISE NOTICE like this:

RAISE NOTICE 'I got here:% is the new value', NEW.col;
like image 103
Laurenz Albe Avatar answered Oct 13 '22 11:10

Laurenz Albe