Re: \0 and IllegalArgumentException
От | Vadim Nasardinov |
---|---|
Тема | Re: \0 and IllegalArgumentException |
Дата | |
Msg-id | 200410291024.03718@vadim.nasardinov обсуждение исходный текст |
Ответ на | \0 and IllegalArgumentException (Sebastiaan van Erk <sebster@sebster.com>) |
Ответы |
Re: \0 and IllegalArgumentException
Re: \0 and IllegalArgumentException |
Список | pgsql-jdbc |
On Friday 29 October 2004 05:55, Sebastiaan van Erk wrote: [...] > however I'm getting: > > java.lang.IllegalArgumentException: \0 not allowed [...] > 2) I will know where it came from (postgres)... [...] > User data CAN in fact contain \0, and the fact that postgres cannot > handle this is an issue of the backend Funny you should mention this. Just yesterday a coworker of mine was bitching about the PostgreSQL JDBC driver's refusal to allow \0 in strings. As he pointed out, it's not totally clear if the blame rests entirely with the backend. Consider these examples: | test=> create table dropme (str varchar(100)); | CREATE TABLE | test=> insert into dropme values ('Hello' || chr(0) || 'world'); | INSERT 160829 1 | test=> select str, length(str) as length from dropme; | str | length | -------+-------- | Hello | 5 | (1 row) | | test=> select str, length(str) as length from dropme where str like '%world'; | str | length | -------+-------- | Hello | 5 | (1 row) | | test=> select str, length(str) as length from dropme where str like '%Welt'; | str | length | -----+-------- | (0 rows) This is with a fairly old version of PosgreSQL: | test=> select substring(version(), 1, 20) as version; | version | ---------------------- | PostgreSQL 7.3.4-RH | (1 row) Not sure how the latest version behaves. I think you do have a point though when you say that \0 should be allowed (and handled properly). Vadim
В списке pgsql-jdbc по дате отправления: