Re: PQfformat question and retrieving bytea data in C

Поиск
Список
Период
Сортировка
От Chris Angelico
Тема Re: PQfformat question and retrieving bytea data in C
Дата
Msg-id CAPTjJmoOAHgGKUJzoLcQgTQNUgsbr+W737KSHqQzVRAfKEQj2Q@mail.gmail.com
обсуждение исходный текст
Ответ на PQfformat question and retrieving bytea data in C  (Jason Armstrong <ja@riverdrums.com>)
Ответы Re: PQfformat question and retrieving bytea data in C  (Jason Armstrong <ja@riverdrums.com>)
Список pgsql-general
On Wed, Aug 29, 2012 at 10:30 PM, Jason Armstrong <ja@riverdrums.com> wrote:
> I see the following:
> 30 5c 33 33 32 5c 30 30 30 5c 30 31 31 5c 30 30
>
> But when I look at the same data in the database:
>
> psql> select encode(substr(data, 0, 16), 'hex') from data_table where id='xxx';
>              encode
> --------------------------------
>  30da00090132420520203137323030

Here's what you're seeing:

0\332\000\011\00

5c is a backslash, the rest are all digits. The backslashes introduce
octal escape codes - that's what bytea_output = 'escape' means. 0332
is 0xda, 011 is 0x09, etc. You're seeing the same values come up in
the cases where they don't need to be escaped, like the 0x30 at the
beginning.

ChrisA


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

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: PQfformat question and retrieving bytea data in C
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: calling a C function from pgsql function