Skip to content

lower_case_table_names=1 causes error #1036

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ghost opened this issue Dec 6, 2022 · 3 comments
Closed

lower_case_table_names=1 causes error #1036

ghost opened this issue Dec 6, 2022 · 3 comments
Labels
VERIFIED verified issue
Milestone

Comments

@ghost
Copy link

ghost commented Dec 6, 2022

-- 修改my.cnf: lower_case_table_names=1
select @@lower_case_table_names;

create schema if not exists a1036;
use a1036;

drop table if exists AAA;
create table AAA (id int primary key auto_increment);
alter table AAA add column val int;
-- alter table 复制报错: table does not exist in sqle.context

现状

  • 当lower_case_table_names=1时, dtle通过修改ast并重写sql (使用tidb parser), 使库表名小
    写化, 然后送至sqleContext计算表结构.

问题

  • sqleContext处理alter table时, 引用了原表(未经小写化)的语句, 而非仅使用ast

修复

  • 重写sql后, 重新生成ast
@ghost
Copy link
Author

ghost commented Dec 7, 2022

Case 2: LowerString(&TableSchemaRegex) 错误

例如\W->\w肯定不对.

@ghost
Copy link
Author

ghost commented Dec 11, 2022

Case 3: review the usage of the variable query8 in binlog_reader.go

ghost pushed a commit that referenced this issue Dec 12, 2022
 with lower_case_table_name=1 #1036-2
ghost pushed a commit that referenced this issue Dec 12, 2022
when mysql lower_case_table_names = 1.
ghost pushed a commit that referenced this issue Dec 12, 2022
- query8 for updateTableMeta was only used for logging
ghost pushed a commit that referenced this issue Dec 12, 2022
 with lower_case_table_name=1 #1036-2
ghost pushed a commit that referenced this issue Dec 12, 2022
when mysql lower_case_table_names = 1.
ghost pushed a commit that referenced this issue Dec 12, 2022
- query8 for updateTableMeta was only used for logging
@ghost ghost closed this as completed Dec 28, 2022
@ghost ghost added this to the 4.22.12.0 milestone Dec 28, 2022
@asiroliu asiroliu added the VERIFIED verified issue label Apr 11, 2023
@asiroliu
Copy link
Collaborator

新增自动化测试用例

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VERIFIED verified issue
Projects
None yet
Development

No branches or pull requests

1 participant