snippetsqlModerate
How to trigger newlines in log messages?
Viewed 0 times
triggerlognewlinesmessageshow
Problem
Is it possible for log messages to span multiple lines? I am expecting:
to result in the following log:
But instead I get:
Any ideas?
RAISE WARNING 'Line 1\nLine 2';to result in the following log:
Line 1
Line 2But instead I get:
Line 1\nLine 2Any ideas?
Solution
It's the same as any other string. Either use non-standard
or use SQL-standard strings with literal newlines:
E'' strings to tell PostgreSQL you want escape processing:RAISE WARNING E'Line 1\nLine 2';or use SQL-standard strings with literal newlines:
RAISE WARNING 'Line 1
Line 2';Code Snippets
RAISE WARNING E'Line 1\nLine 2';RAISE WARNING 'Line 1
Line 2';Context
StackExchange Database Administrators Q#76931, answer score: 15
Revisions (0)
No revisions yet.