This project is archived and is in readonly mode.

#69 ✓resolved
Psycopg website

PQescapeByteaConn does not escape backslashes on postgres 9.1 server

Reported by Psycopg website | September 8th, 2011 @ 11:47 AM

Submitted by: Jonathan Slenders

Still not entirely sure whether this is a bug in psycopg2, but I think it may be.

I have a Django project, with PostGIS setup, and it works perfect on a PostgreSQL 8.4 machine. When I change the settings, in order to connect to a postgres 9.1 server, it doesn't work anymore.

The problem appears when using queries; polygons are encoded using binary_escape, which calls PQescapeByteaConn. Somehow, this function returns single backslashes on my postgres 9.1 server, but double backslahses on postgres 8.4.

The generated query looks like this:

ST_GeomFromEWKB(E'\001\003\000\000 \346\020\000\000\001\000\000\000\005\000\000\000\F...')

Obviously \000 conflicts with zero terminated strings.


Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

<b>WARNING:</b> the informations in this tracker are archived. Please submit new tickets or comments to <a href="">the new tracker</a>.
Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.

Shared Ticket Bins


Referenced by