bytea insert difference between 8.3 and 9.x

Поиск
Список
Период
Сортировка
От Gregg Jaskiewicz
Тема bytea insert difference between 8.3 and 9.x
Дата
Msg-id CAJY59_h85m4B7enZ6bmHVeghHzwbq_R4tNdv90wM1UUXbWJfQA@mail.gmail.com
обсуждение исходный текст
Ответы Re: bytea insert difference between 8.3 and 9.x
Список pgsql-general
So consider this code C++, using libpqxx:

string = "INSERT INTO foo(x) VALUES( E'" + T.esc_raw(data) + "' )";

foo(x) is bytea , before you ask.

On 8.3, it works fine.
On 9.x:

ERROR:  invalid byte sequence for encoding "UTF8": 0x00 (if \000 is in
the string).

Now, I can take out the E'' and it will work fine on 9.X, but will
whine about it on 8.3. (HINT:  Use the escape string syntax for
escapes, e.g., E'\r\n'.)


I need one piece of code that will work on both, what should I do in
this case ?

Thanks.

--
GJ

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

Предыдущее
От: Andreas Kretschmer
Дата:
Сообщение: Re: changing from postgreSQL 8.3 to 9.0
Следующее
От: Venkat Balaji
Дата:
Сообщение: : PostgreSQL Online Backup