In today’s article, we will discusses the RAISE command for reporting errors, warnings, and other report messages within stored procedures and functions in PostgreSQL.
General usage of the RAISE structure is as follows.
RAISE level , format
The RAISE structure is generally used with the following parameters:
LOG
NOTICE
DEBUG
INFO
EXCEPTION
WARNING
Let’s try the raise parameters above using variables.
1 2 3 4 5 6 7 8 | DO $$ BEGIN RAISE INFO '"INFO" mesajı %', now() ; RAISE LOG 'Log mesajı %', now(); RAISE DEBUG 'Debug Mesajı %', now(); RAISE WARNING 'Warning Mesajı %', now(); RAISE NOTICE 'Notice Mesajı %', now(); END $$; |
When we notice above, the LOG and DEBUG sections are not visible and other messages are not visible.
You can use these levels as INFO, NOTICE, WARNING depending on the critical level.