[MDEV-13671] InnoDB should use case-insensitive column name comparisons like the rest of the server Created: 2017-08-29 Updated: 2020-10-20 Resolved: 2018-11-05 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB, Storage Engine - XtraDB |
| Affects Version/s: | 5.5, 10.0, 10.1, 10.2, 10.3, 10.4 |
| Fix Version/s: | 10.3.11, 10.2.19, 10.1.38, 10.0.38 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Marko Mäkelä | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | compat56, corruption, ddl | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||
| Description |
|
One way how the InnoDB internal data dictionary can get out of sync with the .frm files is when columns are renamed between upper case and lower case, so that there is no change when considering a case-insensitive match. A change in MySQL 5.6.22 adjusted fill_alter_inplace_info() so that for InnoDB, it performs a case-sensitive column name comparison, while for other storage engines it uses the old my_strcasecmp(). A more robust fix would be to make all column name comparisons in InnoDB case insensitive. This is safe to do, because there are no indexes defined on the InnoDB internal data dictionary tables SYS_COLUMNS and SYS_FOREIGN_COLS. |
| Comments |
| Comment by Elena Stepanova [ 2017-08-29 ] | |||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-10-17 ] | |||||||||||||||||||||||||||||||||
|
Starting with
| |||||||||||||||||||||||||||||||||
| Comment by Eugene Kosov (Inactive) [ 2018-10-26 ] | |||||||||||||||||||||||||||||||||
|
Crash of 10.2 can't be fixed in 10.0 because relevant code is missed there. Fix is: replace strcmp() with my_strcasecmp(). | |||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-10-26 ] | |||||||||||||||||||||||||||||||||
|
Right, 10.2 introduced virtual columns inside InnoDB. Before that, virtual columns were ‘filtered out’ from the metadata that was passed to InnoDB. Hence, we will need separate fixes for 10.2 and earlier versions. | |||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-10-29 ] | |||||||||||||||||||||||||||||||||
|
The 10.0 fix looks OK, but I’d like to see a test that restarts the server after changing the case of a column name, and possibly adding a FOREIGN KEY constraint referring to such a renamed column in a parent table. Would FOREIGN KEY constraints on the renamed column keep working? Also, I would like to see a separate 10.2 version of the fix. | |||||||||||||||||||||||||||||||||
| Comment by Eugene Kosov (Inactive) [ 2018-10-29 ] | |||||||||||||||||||||||||||||||||
|
I'm not sure I understood you correctly. This one test?
| |||||||||||||||||||||||||||||||||
| Comment by Eugene Kosov (Inactive) [ 2018-11-01 ] | |||||||||||||||||||||||||||||||||
|
Commit message fixed. Looks like it's ready for a more thorough testing? | |||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-11-02 ] | |||||||||||||||||||||||||||||||||
|
I pushed this to bb-10.2-marko together with | |||||||||||||||||||||||||||||||||
| Comment by Matthias Leich [ 2018-11-05 ] | |||||||||||||||||||||||||||||||||
|
During RQG testing of bb-10.2-marko no problems which might be related to |