Opened 4 years ago

Closed 4 years ago

#5160 closed defect (fixed)

Escaping problem in PGDump driver with Postgres >= 9.1

Reported by: Even Rouault Owned by: Even Rouault
Priority: normal Milestone: 1.10.1
Component: OGR_SF Version: unspecified
Severity: normal Keywords: pg postgresql escaping
Cc:

Description

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.

Change History (1)

comment:1 Changed 4 years ago by Even Rouault

Resolution: fixed
Status: newclosed

Fixed in trunk (r26196) and branches/1.10 (r26197)

Note: See TracTickets for help on using tickets.