Escaping problem in PGDump driver with Postgres >= 9.1
|Reported by:||Even Rouault||Owned by:||Even Rouault|
|Severity:||normal||Keywords:||pg postgresql escaping|
Since Postgres 9.1 (http://www.postgresql.org/docs/9.1/static/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS) the escaping rules have changed :
"If the configuration parameter standard_conforming_strings is off, then PostgreSQL recognizes backslash escapes in both regular and escape string constants. However, as of PostgreSQL 9.1, the default is on, meaning that backslash escapes are recognized only in escape string constants. This behavior is more standards-compliant, but might break applications which rely on the historical behavior, where backslash escapes were always recognized. As a workaround, you can set this parameter to off, but it is better to migrate away from using backslash escapes. If you need to use a backslash escape to represent a special character, write the string constant with an E."
A workaround for now that will work for all Postgres versions is to emit "SET standard_conforming_strings = OFF"
Later we could just remove that line and remove escaping of backslashes.