Vertica uses standard conforming strings as specified in the SQL standard, which means that backslashes are treated as string literals, not escape characters.
But what if I want backslashes to be treated as an escape character? One way is to turn off standard conforming strings!
Example:
The “\n” escape sequence typically is translated into a new line character. But in Vertica, by default it’s treated literally as “\n”.
Code: Select all
dbadmin=> SELECT 'New\nLine';
?column?
-----------
New\nLine
(1 row)
Code: Select all
dbadmin=> SET standard_conforming_strings TO off;
SET
dbadmin=> SELECT 'New\nLine';
WARNING 4168: Nonstandard use of escape in a string literal at or near "'New\n" at character 8
HINT: Use the escape string syntax for escapes, e.g., E'\r\n'
?column?
----------
New
Line
(1 row)
Code: Select all
dbadmin=> SET escape_string_warning TO off;
SET
dbadmin=> SELECT 'New\nLine';
?column?
----------
New
Line
(1 row)