Re: PQescapeByteaConn - returns wrong string for PG9.1 Beta3

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Petro Meier" <Petro85(at)gmx(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: PQescapeByteaConn - returns wrong string for PG9.1 Beta3
Date: 2011-08-04 20:54:14
Message-ID: 14970.1312491254@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Petro Meier" <Petro85(at)gmx(dot)de> writes:
> INSERT INTO "testtable" ("ID", "BinaryContents") values (1,
> E'\xea2abd8ef3');
> returns "invalid byte sequence".

> '\xea2abd8ef3' is the string delivered by the PG 9.1 Beta3 server
> when calling PQescapeByteaConn(). It cannot be further processed by the
> server itself afterwards! There is a leading '\' missing.

No, there isn't. What you are doing wrong is prepending an E to the
literal. You should not be doing that, neither in 9.1 nor any previous
version.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-08-04 20:55:35 Re: Reduce WAL logging of INSERT SELECT
Previous Message Peter Geoghegan 2011-08-04 20:49:22 Re: Further news on Clang - spurious warnings