Type: bool
Default: on
Context: user
Restart: false

This controls whether ordinary string literals ('...') treat backslashes literally, as specified in the SQL standard. Beginning in PostgreSQL 9.1, the default is on (prior releases defaulted to off). Applications can check this parameter to determine how string literals will be processed. The presence of this parameter can also be taken as an indication that the escape string syntax (E'...') is supported. Escape string syntax (sql-syntax-strings-escape) should be used if an application desires backslashes to be treated as escape characters.

Recommendations

If you can clean up your application code, this disables use of \ as an escape character except in escaped (E' ') strings. This is both safer, and less likely to result in unexpected output for things like Windows filepaths.

Comments