Re: Differences in Escaped bytea's when creating a plain pg_dump
От | Daniel Verite |
---|---|
Тема | Re: Differences in Escaped bytea's when creating a plain pg_dump |
Дата | |
Msg-id | 488f2958-2417-4086-b138-eafb22e0a3f7@manitou-mail.org обсуждение исходный текст |
Ответ на | Re: Differences in Escaped bytea's when creating a plain pg_dump (WR <wolle321@freenet.de>) |
Список | pgsql-general |
WR wrote: > But one question is left. > > When I read this valid data into a c++ std::string (and I checked that > the single backslashes are still there). Why can't I put this > SQL-command to a pqxx-transaction and execute it. It looks like the > pqxx-transaction unescapes the bytea-string and then it finds the 0x00 > bytes, which are not allowed in text-strings but should be in bytea-strings. You may check your server logs. They would have the error messages with the queries as received by the server. Note that passing '\000'::bytea with a single backslash can be incorrect if standard_conforming_strings if set to off (not recommended since version 8.1). In that case the backslashes need to be doubled. Example: postgres=# set standard_conforming_strings to off; SET postgres=# set escape_string_warning to off; SET postgres=# select '\000'::bytea; ERROR: invalid byte sequence for encoding "UTF8": 0x00 postgres=# select '\\000'::bytea; bytea ------- \x00 (1 row) There might also be a problem with how the string is being fed with the C++ code, but you'd need to show us the code to get feedback on it. Best regards, -- Daniel Vérité https://postgresql.verite.pro/ Twitter: @DanielVerite
В списке pgsql-general по дате отправления: