Open jianglianggithub opened 3 weeks ago
MYSQL
5.7
1.2.24
OPENjdk 8
select a.name1, b.* from (select id , name1 from a) a join (select b.id , name2 from b) b on a.id = b.id 对于该SQL使用如下代码把b.*进行处理的时候出现解析结果不符合实际情况
select a.name1, b.* from (select id , name1 from a) a join (select b.id , name2 from b) b on a.id = b.id
SQLStatement stmt = SQLUtils.parseSingleStatement(sql, DbType.mysql); repository.resolve(stmt, ResolveAllColumn, ResolveIdentifierAlias); System.out.println(stmt.toString());
SQLStatement stmt = SQLUtils.parseSingleStatement(sql, DbType.mysql);
repository.resolve(stmt, ResolveAllColumn, ResolveIdentifierAlias);
System.out.println(stmt.toString());
控制台输出的结果为
SELECT a.name1, a.id, b.name2 FROM ( SELECT id, name1 FROM a ) a JOIN ( SELECT b.id, name2 FROM b ) b ON a.id = b.id
正确的结果应该是
SELECT a.name1, b.id, b.name2 FROM ( SELECT id, name1 FROM a ) a JOIN ( SELECT b.id, name2 FROM b ) b ON a.id = b.id
我认为这是一个SQL解析的BUG
No response
Database Type
MYSQL
Database Version
5.7
Druid Version
1.2.24
JDK Version
OPENjdk 8
Error SQL
select a.name1, b.* from (select id , name1 from a) a join (select b.id , name2 from b) b on a.id = b.id
对于该SQL使用如下代码把b.*进行处理的时候出现解析结果不符合实际情况SQLStatement stmt = SQLUtils.parseSingleStatement(sql, DbType.mysql);
repository.resolve(stmt, ResolveAllColumn, ResolveIdentifierAlias);
System.out.println(stmt.toString());
控制台输出的结果为
正确的结果应该是
我认为这是一个SQL解析的BUG
Testcase Code
No response
Stacktrace Info
No response
Error Info
No response