#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.

Thanks,
Jonathan

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

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

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

Attachments

Referenced by

Pages