[MDEV-28644] Unexpected error on ALTER TABLE t1 CONVERT TO CHARACTER SET utf8mb3, DEFAULT CHARACTER SET utf8mb4 Created: 2022-05-23  Updated: 2022-06-03  Resolved: 2022-05-24

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

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

Issue Links:
Relates
relates to MDEV-27896 Wrong result upon `COLLATE latin1_bin... Closed
relates to MDEV-28117 Multiple conflicting table COLLATE cl... Closed

 Description   

It's impossible to convert a table to some character set, but at the same time set the DEFAULT character set to another character set:

ALTER TABLE t1 CONVERT TO CHARACTER SET utf8mb3, DEFAULT CHARACTER SET utf8mb4;

ERROR 1302 (HY000): Conflicting declarations: 'CHARACTER SET utf8mb3' and 'CHARACTER SET utf8mb4'

The problem happens because the code handling both clauses uses HA_CREATE_INFO::default_table_charset to check conflicting declarations.

The test for conflicts was added by MDEV-7387. Before MDEV-7387 it worked even worse:

ALTER TABLE t1 CHARACTER SET utf8, CONVERT TO CHARACTER SET latin1;

ignored the utf8 part and just use the latin1 part for both conversion and DEFAULT.

It should be fixed to allow any combinations of cs1/cl1 and cs2/cs2 in:

  • [DEFAULT] CHARACTER SET cs1 [COLLATE cl1], and
  • CONVERT TO CHARACTER SET cs2 [COLLATE cs2]


 Comments   
Comment by Alexander Barkov [ 2022-05-24 ]

Pushed in a joint patch together with MDEV-27896

Generated at Thu Feb 08 10:02:22 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.