I have an H2 table with a varchar column with a check constraint defined like this:
CONSTRAINT my_constraint CHECK (varchar_field <> '')
The following insert statement fails, but succeeds when I remove the constraint or insert any other value that is not just the minus sign ("-").
PreparedStatement ps= con.prepareStatement("INSERT INTO my_table (id, varchar_field) VALUES (?, ?);");
ps.setInt(1, id);
ps.setString(2, "-");
ps.executeUpdate();
Update: further tests reveal behavior that I do not understand. Is the minus sign some kind of string literal operator in SQL/H2 database? If yes, how do I escape it?
