Search Postgresql Archives

bytea insert difference between 8.3 and 9.x

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux