Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
252 views
in Technique[技术] by (71.8m points)

debugging - How to debug postgresql stored procedures?

I realize that there is nothing similar to SQL Server Management Studio, so I am mentally prepared to use the good old printf debugging.

The only question is how to do "printf" from a stored procedure?

question from:https://stackoverflow.com/questions/20190406/how-to-debug-postgresql-stored-procedures

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

To "print" a message, you can use raise notice from within a PL/pgSQL function:
http://www.postgresql.org/docs/current/static/plpgsql-errors-and-messages.html

Note that the client must have set the value of "client_min_messages" to the appropriate level in order to receive the "notice".

pgAdmin has a debugger for functions: http://www.pgadmin.org/docs/1.18/debugger.html

(But I have never use it as I don't use pgAdmin).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...