Reputation: 53
I want to debug or use log for a PgSql stored Procedure. Can any one help me ?
Upvotes: 4
Views: 5813
Reputation: 6713
The usual method is to use RAISE NOTICE inside of a PLPGSQL function:
create function test(some_string text) returns void as $$
BEGIN
RAISE NOTICE 'Some string: %', some_string;
END
$$
LANGUAGE PLPGSQL;
# select test('!');
psql: NOTICE: Some string: !
test
------
(1 row)
Whether this message actually shows up in the logs and for the client depends on the settings of log_min_messages and client_min_messages, respectively.
Upvotes: 3