I have the following function for handling exception.
create or replace function fun_test(a varchar) returns void as
$$
begin
insert into test values(a);
exception when others
then
raise info '%',SQLSTATE;
end;
$$
The above function gives me the output:
OUTPUT :
INFO: 42804
Note : I want to record the same output in the *.log file.
log_min_messages
(enum) Controls which message levels are written to the server log. Valid values are DEBUG5, DEBUG4, DEBUG3, DEBUG2, DEBUG1, INFO, NOTICE, WARNING, ERROR, LOG, FATAL, and PANIC. Each level includes all the levels that follow it. The later the level, the fewer messages are sent to the log. The default is WARNING. Note that LOG has a different rank here than in client_min_messages. Only superusers can change this setting.
If you set it to INFO, your raise output will appear in postgres logs
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.