I see that in CVS head, if you turn on standard_conforming_strings,
it still whines about backslashes:
regression=# set standard_conforming_strings to 1;
SET
regression=# select '1234\5678';
WARNING: nonstandard use of escape in a string literal
LINE 1: select '1234\5678'; ^
HINT: Use the escape string syntax for escapes, e.g., E'\r\n'.?column?
-----------1234\5678
(1 row)
regression=#
This seems fairly broken to me. The message is completely off base,
because it's not an "escape", it's a literal backslash, and it's most
certainly not "nonstandard". The HINT is inappropriate too.
The code appears to think that it should warn about backslashes if
escape_string_warning is on, regardless of standard_conforming_strings.
This seems like a pretty dubious decision. I think that as a matter of
policy, we should not be throwing warnings about 100%-SQL-standard
constructs. If someone wants help finding unsafe usages in an old
application, shouldn't they be doing that *before* they turn on
standard_conforming_strings?
So I'd like to suppress the message altogether in this case, but if
we keep it, it needs to be phrased more relevantly.
regards, tom lane