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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Graham Murray <gmurray(at)webwayone(dot)co(dot)uk>
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-02 18:21:00
Message-ID: 4589.1320258060@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martín Marqués 2011-11-02 18:21:42 Re: 9.1 replication on different arch
Previous Message Alex Hunsaker 2011-11-02 17:59:00 Re: OOM Killer / PG9 / RHEL 6.1