Comments - column name work as a case insenstive

5 months, 3 weeks ago Ian Gilfillan

You haven't given any details of your table or the failing query, but it sounds like you're using a case-insensitive collation. See Character Set and Collation Overview.

For example:

CREATE OR REPLACE TABLE t1 (
  c VARCHAR(1) COLLATE latin1_swedish_ci PRIMARY KEY 
);
INSERT INTO t1 VALUES ('A'),('a');
ERROR 1062 (23000): Duplicate entry 'a' for key 'PRIMARY'

Everything is fine if you use a case-sensitive collation:

CREATE OR REPLACE TABLE t2 (
  c VARCHAR(1) COLLATE latin1_bin PRIMARY KEY 
);
INSERT INTO t2 VALUES ('A'),('a');
 
5 months, 3 weeks ago animesh jain

I guess they are facing the issue while inserting the value 'a' after inserting 'A'. As MariaDB is not able to identify whether the 'a' or 'A' are different. I think there might be some configuration that needs to be set so that the MariaDB works in Case-Sensitive mode.

 
5 months, 3 weeks ago Ian Gilfillan

Have you looked at the collation?

 
5 months, 3 weeks ago animesh jain

Yup, so if we change the default collation from "latin1_swedish_ci " to "latin1_bin" then the comparison will be case-sensitive. Thanks to you Let me modify this.

 
5 months, 3 weeks ago pinki pandey

how can be set as a globally?.it will work for one table.

 
2 weeks, 3 days ago Julian Egelstaff

I think you'd have to change collation on all tables. And you can set collation for the database itself too, which affects newly created tables?

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.