Re: [HACKERS] ECPG and bytea

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: [HACKERS] ECPG and bytea
Дата
Msg-id 3EFB2792.8080807@joeconway.com
обсуждение исходный текст
Ответ на ECPG and bytea  (Lee Kindness <lkindness@csl.co.uk>)
Список pgsql-interfaces
Lee Kindness wrote:
> Guys, surely some one's done this before? I've tried using
> PQescapeBytea too, but still get (slightly) different output. If I try
> and insert "\x02\x01\x02\x03\x04hello\x05\x64\x99\x45" I get (int
> values of chars printed):
> 
> INSERT: 2   1   2   3   4 104 101 108 108 111   5 100 -103  69
> SELECT: 2   1   2   3   4 104 101 108 108 111   5 100   92  50  51  49  69
> 
> hoping someone has a quick answer... if not I'll post a full source
> example and look into it more...
> 

I don't know much about ecpg, but here are some thoughts:

regression=# select x'99'::int; int4
------  153
(1 row)

regression=# select chr(-103) = chr(153); ?column?
---------- t
(1 row)

So the insert looks correct but affected by signed vs unsigned char somehow.

As far as the select goes, I'm wondering if your database is using UTF8 
encoding or something like that. That would explain a high bit character 
getting converted to 4 bytes, I think.

HTH,

Joe




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

Предыдущее
От: Lee Kindness
Дата:
Сообщение: ECPG and bytea
Следующее
От: Nicolás Alvarez
Дата:
Сообщение: libpq++ on sco openserver