Re: Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns
Дата
Msg-id 7640.1226334369@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns  (Mario Splivalo <mario.splivalo@megafon.hr>)
Ответы Re: Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns  (Mario Splivalo <mario.splivalo@megafon.hr>)
Список pgsql-sql
Mario Splivalo <mario.splivalo@megafon.hr> writes:
> Tom Lane wrote:
>> Exactly what version of pg_dump are you using?  What I get from pg_dump
>> doesn't look like that.  Bytea fields with -D look more like this:
>> 
>> INSERT INTO foo (f1) VALUES ('\\305S\\224\\226\\203)');

> Yes, I mistakenly used pg8.2 pg_dump, when I use pg3.8 dump I get what 
> you get.

I was quoting the output of 8.2.latest pg_dump.  Maybe you have a very
old subrelease?  But no version of pg_dump would've put an explicit
cast to bytea in there.

> Btw, what is that S after 305?

Hex 53 is 'S' I believe.

> 305 octal is C5 hexadecimal. How 
> do I enter hexadecimal C5 without UTF encoding errors?

bytea only supports octal, so \\305 is the way to do it.  The way you
were doing it was guaranteed to fail on corner cases such as \0 and \
itself, because you were converting at the string-literal stage not
byteain().
        regards, tom lane


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

Предыдущее
От: Mario Splivalo
Дата:
Сообщение: Re: Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Using UTF strings in pg8.3 - storing hexadecimal values in bytea columns