Re: postgresql-9.1.1 PQescapeByteaConn() generating incorrectly quoted output.

From: Graham Murray <gmurray(at)webwayone(dot)co(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: postgresql-9.1.1 PQescapeByteaConn() generating incorrectly quoted output.
Date: 2011-11-04 08:37:44
Message-ID: 1320395864.17705.94.camel@gmdev.webwayone.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2011-11-02 at 18:21 +0000, Tom Lane wrote:
> Graham Murray <gmurray(at)webwayone(dot)co(dot)uk> writes:
> > Since upgrading test systems to postgresql 9.1, I am seeing some
> inserts
> > to bytea fields giving errors such as "ERROR: invalid byte sequence
> for
> > encoding "UTF8": 0xf9" Where the insert is from a C program using
> libpq
> > and is of the form "insert into xxx values(E'%s')" where the value
> is
> > the return of PQescapeByteaConn();
>
> That is incorrect coding. The result of PQescapeByteaConn has never
> been meant to be put into an E'' literal. You might have managed to
> get away with it so long as standard_conforming_strings was off in the
> server, but it's on by default in 9.1.

Thanks.
I have now changed it (for the next application release) to use
'plain' not E'' strings. Originally I was using non-E strings, but I
changed it because 9.0.x (with the default
standard_conforming_strings=off) gave a warning suggesting that they
should be E' escaped.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2011-11-04 09:06:35 Re: ERROR from pg_restore - From OS X to Ubuntu
Previous Message Magnus Hagander 2011-11-04 07:26:59 Re: ERROR from pg_restore - From OS X to Ubuntu