Hi,
H2 uses java.text.Collator, and it looks like this is how it works. I
didn't know about this before:
Collator collator = Collator.getInstance(new Locale("en"));
collator.setStrength(Collator.PRIMARY);
System.out.println(collator.compare("E-12345", "E12345"));
This prints 0 for me, meaning the two match.
Regards,
Thomas
On Thu, Dec 19, 2013 at 8:55 AM, andreis <[email protected]> wrote:
> Version 1.3.174.
>
> Change of COLLATION influences how strings are checked for equality.
>
> SET COLLATION en STRENGTH PRIMARY;
> CREATE TABLE TBL_IGN_CASE ( STR VARCHAR(100) PRIMARY KEY );
> INSERT INTO TBL_IGN_CASE ( STR ) VALUES ('E-12345');
> INSERT INTO TBL_IGN_CASE ( STR ) VALUES ('E12345');
>
> > Unique index or primary key violation: "PRIMARY_KEY_4 ON
> PUBLIC.TBL_IGN_CASE(STR) VALUES ( /* 2 */ CAST('E12345' AS
> VARCHAR_IGNORECASE) )"; SQL statement:
> INSERT INTO TBL_IGN_CASE ( STR ) VALUES ('E12345') [23505-174] 23505/23505
>
> Such query ` SELECT true FROM TBL_IGN_CASE WHERE 'E-12345' = 'E12345' `
> returns `true`.
>
> Is it expected behaviour?
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.