Bug #116363 is_explicit_collation is false even column specifies a different collation
Submitted: 16 Oct 2024 3:17 Modified: 16 Oct 2024 6:57
Reporter: Jinyou Ma Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Data Dictionary Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[16 Oct 2024 3:17] Jinyou Ma
Description:
The is_explicit_collation is false, even the collate of the column does match the collate of the table.
The COLLATE of column a is utf8mb4_bin, and the COLLATE of the table is utf8mb4_unicode_ci.
mysql> show create table ta\G
*************************** 1. row ***************************
       Table: ta
Create Table: CREATE TABLE `ta` (
  `a` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
1 row in set (0.01 sec)
However, the is_explicit_collation is false in ibd.

shell> ibd2sdi /var/lib/mysql/test/ta.ibd | jq '.[1].object.dd_object.columns[0] | {is_explicit_collation: .is_explicit_collation}'
{
  "is_explicit_collation": false
}

After recreating the table, the is_explicit_collation becomes true.

ibd2sdi /var/lib/mysql/test/ta.ibd | jq '.[1].object.dd_object.columns[0] | {is_explicit_collation: .is_explicit_collation}'
{
  "is_explicit_collation": true
}

How to repeat:
- create the table in mysql
create database test;
use test
create table ta ( 
`a` char(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

- check the is_explicit_collation with idb2sdi
ibd2sdi /var/lib/mysql/test/ta.ibd | jq '.[1].object.dd_object.columns[0] | {is_explicit_collation: .is_explicit_collation}'

- recreate the table with mysqldump
mysqldump test ta | mysql test

- check the is_explicit_collation again with idb2sdi
ibd2sdi /var/lib/mysql/test/ta.ibd | jq '.[1].object.dd_object.columns[0] | {is_explicit_collation: .is_explicit_collation}'
[16 Oct 2024 6:57] MySQL Verification Team
Hello Jinyou Ma,

Thank you for the report and test case.
verified as described.

regards,
Umesh
[16 Oct 2024 7:47] MySQL Verification Team
IMHO This is duplicate of Bug #114717, please see Bug #114717
If you have no objections then will mark it as a duplicate of Bug #114717.

regards,
Umesh