Skip site navigation (1) Skip section navigation (2)

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

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Petro Meier <petro85(at)gmx(dot)de>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PQescapeByteaConn - returns wrong string for PG9.1 Beta3
Date: 2011-07-27 21:19:39
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers

On 07/27/2011 02:05 PM, Alvaro Herrera wrote:
> Excerpts from Petro Meier's message of miƩ jul 27 02:51:22 -0400 2011:
>> If  I use PQescapeByteaConn() for a conenction to a PG9.1 Beta3 server,
>> this function returns (e.g.) "\xea2abd8ef31...(and so on.)...".
>>          Here the problem: there should be a second backslash in the prefix.
>> The SQL Statement which uses this string (INSERT statement in my case)
>> returns with an error ("Invalid byte sequence..."). If I add the second
>> backslash manually everything works fine.
> You're just being bitten by the fact that the
> standard_conforming_strings setting changed its default from false to
> true.  If you want the old behavior, you can just flip the switch, but
> the recommended action is to change your expectations.  You can use E''
> if you want backslashes to continue working without changing the switch.

Or even better don't interpolate it into SQL at all, but use a statement 



In response to

pgsql-hackers by date

Next:From: Pavel StehuleDate: 2011-07-27 21:20:37
Subject: Re: patch for 9.2: enhanced errors
Previous:From: Peter EisentrautDate: 2011-07-27 21:19:02
Subject: Re: psql: bogus descriptions displayed by \d+

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group