[MDEV-28117] Multiple conflicting table COLLATE clauses are not rejected Created: 2022-03-18  Updated: 2022-06-15  Resolved: 2022-06-03

Status: Closed
Project: MariaDB Server
Component/s: Character Sets
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9
Fix Version/s: 10.9.2

Type: Bug Priority: Critical
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-27743 Remove Lex::charset Closed
relates to MDEV-27782 Wrong columns when using table level ... Closed
relates to MDEV-28067 Multiple conflicting column COLLATE c... Closed
relates to MDEV-28644 Unexpected error on ALTER TABLE t1 CO... Closed
relates to MDEV-27906 CREATE TABLE/DATABASE .. CHARSET .. C... Closed

 Description   

The problem described in MDEV-28067 is also repeatable on the table level:

CREATE OR REPLACE TABLE t1 (a CHAR(10)) COLLATE latin1_swedish_ci COLLATE latin1_bin;
SHOW CREATE TABLE t1;

+-------+------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                 |
+-------+------------------------------------------------------------------------------------------------------------------------------+
| t1    | CREATE TABLE `t1` (
  `a` char(10) COLLATE latin1_bin DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin |
+-------+------------------------------------------------------------------------------------------------------------------------------+

The expected behaviour would be to return a "conflicting declarations" error.

The problem is also repeatable on the database level:

CREATE OR REPLACE database db1 COLLATE latin1_swedish_ci COLLATE latin1_bin;
SHOW CREATE DATABASE db1;

+----------+-----------------------------------------------------------------------------------+
| Database | Create Database                                                                   |
+----------+-----------------------------------------------------------------------------------+
| db1      | CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_bin */ |
+----------+-----------------------------------------------------------------------------------+
1 row in set (0.001 sec)



 Comments   
Comment by Alexander Barkov [ 2022-06-03 ]

This problem was earlier fixed by the patch for MDEV-27896.

Added MTR tests from the report.

Generated at Thu Feb 08 09:58:11 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.