Raise function
In PostgreSQL, this function is used to print strings, similar to() in Java and dbms_output.put_line() in Oracle.
The usage is as follows:
raise notice 'My name is %, I am a %.', 'Lewis', 'coder';
The above sql will output My name is Lewis, I am a coder. in the console. If you are using this function in DBeaver, the string will be output in the output tab.
The notice behind raise is the level, there are a total of debug/log/info/Notice/warning/exception and you can specify any level. Some are similar to the log frameworks in Java, such as Log4j2.
Next, the string parameters to be output are followed by the level, which are included in a pair of single quotes. This string supports the writing of placeholders, which is the character %. If this % is used in a string, the % here will be replaced by the arguments followed by the string parameter.
As many placeholders as there are, you need to add the corresponding parameters after the first string parameter.
The usage of this placeholder output is also similar to Log4j2.
The information printed by raise can be output to the server log, to the client, or to both at the same time.
This is controlled by the two parameters log_min_messages and client_min_messages, which are used during database initialization.
Supplement: postgres stored procedure print print output debug
I won't say much nonsense, let's just read the code~
declare v1 integer; RAISE NOTICE 'value %',v1
The above is personal experience. I hope you can give you a reference and I hope you can support me more. If there are any mistakes or no complete considerations, I would like to give you advice.