Re: Strange error using postgres 8.2 + JDBC 8.2 driver

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: Strange error using postgres 8.2 + JDBC 8.2 driver
Дата
Msg-id Pine.BSO.4.64.0701171216380.15760@leary2.csoft.net
обсуждение исходный текст
Ответ на Re: Strange error using postgres 8.2 + JDBC 8.2 driver  (Csaba Nagy <nagy@ecircle-ag.com>)
Список pgsql-jdbc

On Wed, 17 Jan 2007, Csaba Nagy wrote:

>> This will actually happen in 8.1 servers if you are running the latest
>> releases.  Previously, inserting something like "a\0b" would silently
>> truncate at the null byte, but now it's an error.  So, check your data for
>> \0.
>
> Well, if the 0 bytes are in the byte array, I would expect that to be
> OK, the driver should escape them, right ? (I actually tested this, it
> works).

Right, bytea data can contain 0.

> Other than that, the parameters are plain strings and primitives, so I
> would also be surprised to be able to insert invalid 0 bytes in those...
> Could it be that we have some strange characters not properly encoded by
> the driver ?
>

Java is not C where 0 is a string terminator.  Java String objects may
contain embedded 0 characters.  The driver encodes these correctly and
sends them to the server which rejects them.  The server being written in
C has code everywhere that treats 0 as a terminator and it cannot
correctly handle embedded 0s.  You have 0s somewhere in your string data.

Kris Jurka

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

Предыдущее
От: Csaba Nagy
Дата:
Сообщение: Re: Strange error using postgres 8.2 + JDBC 8.2 driver
Следующее
От: Csaba Nagy
Дата:
Сообщение: Re: Strange error using postgres 8.2 + JDBC 8.2 driver