Hi!

The issue has been partially discussed over the Internet,
but I haven't found full clarification yet.

I'm using Derby 10.2.2.0, JDK 1.6.0_01 on a Linux 2.6 box.


If I have a table with a VARCHAR field
with a UNIQUE constraint placed on that field,
I can't insert two records that differ only in trailing space,
say 'foo' and 'foo '.


Moreover, if I drop the constraint and insert those
two different records, the Derby engine treats them as equal,
meaning both

SELECT * from <...> WHERE <...> = 'foo'

and

SELECT * from <...> WHERE <...> = 'foo '

return 2 records instead of 1.


In all cases, the trailing space is preserved, however,
so I can distinguish the records once I fetch them via JDBC
(of course, string literals "foo" and "foo " are not equivalent in Java).


I have 2 questions:

1. Is the described above a legitimate behaviour of Derby?

2. Can I somehow turn this behaviour off
(for Derby to behave more like Oracle)?


Thanks.

--
Andrew ``Bass'' Shcheglov
http://www.2ka.mipt.ru/~bass/
http://www.softlogic.ru/


--
Andrew ``Bass'' Shcheglov
http://www.2ka.mipt.ru/~bass/
http://www.softlogic.ru/

Reply via email to