Re: Invalid message format
От | Oliver Jowett |
---|---|
Тема | Re: Invalid message format |
Дата | |
Msg-id | 4064BFE2.2030609@opencloud.com обсуждение исходный текст |
Ответ на | Invalid message format (Mikhail Ts <ts_mike@yahoo.ca>) |
Список | pgsql-jdbc |
Mikhail Ts wrote: > Hi, > I've found what was causing the problem - one of my INSERT statements > contained 0x00 byte inside a String field. I don't know if it is a bug > - I've modified my code accordingly and everything went OK. As I understand it, you can't represent a \0 byte in a text/varchar constant; this seems to be due to the way the backend internally represents these types. I always get horribly confused in this area since these representations are encoding-dependent, though.. You should be able to represent it ok in a bytea constant (but then of course you need a bytea field to store it in..) If you were using PreparedStatement.setString() to set a String parameter containing an embedded \0, recent drivers should have thrown an IllegalArgumentException well before the query hit the backend. I'm interested to know exactly how you managed to get a \0 into the query -- were you constructing the whole INSERT string yourself rather than using PreparedStatement parameters? I don't think the queries themselves are checked, from memory. -O
В списке pgsql-jdbc по дате отправления: