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

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

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Petro Meier <petro85(at)gmx(dot)de>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PQescapeByteaConn - returns wrong string for PG9.1 Beta3
Date: 2011-07-27 18:05:10
Message-ID: 1311789809-sup-3275@alvh.no-ip.org (view raw or flat)
Thread:
Lists: pgsql-hackers
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.

-- 
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

pgsql-hackers by date

Next:From: Robert HaasDate: 2011-07-27 18:29:10
Subject: Re: sinval synchronization considered harmful
Previous:From: Noah MischDate: 2011-07-27 17:58:11
Subject: Re: sinval synchronization considered harmful

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