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

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: PQescapeByteaConn - returns wrong string for PG9.1 Beta3
Дата
Msg-id 4E3080EB.7090008@dunslane.net
обсуждение исходный текст
Ответ на Re: PQescapeByteaConn - returns wrong string for PG9.1 Beta3  (Alvaro Herrera <alvherre@commandprompt.com>)
Список 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 
placeholder.

cheers

andrew


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: psql: bogus descriptions displayed by \d+
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: patch for 9.2: enhanced errors