druid 带having子句的sql解析有问题

vlju58qv  于 3个月前  发布在  Druid
关注(0)|答案(1)|浏览(42)

select id, sharding_id , count(company_id) as r from customer group by sharding_id order by id having r = 10000;
上面这个句子用解析器的parseStatement()方法尽然不报错,只是返回的语句里把having r = 10000给去除了。

i7uq4tfw

i7uq4tfw1#

实际上任何字符都可以,例如:select id, sharding_id , count(company_id) as r from customer group by sharding_id order by id dfdfdf;因为解析的过程是parseFrom->parseWhere->parseHierachical-->parseGroupBy->parseOrderBy,之后是按合法sql语句可能出现的关键词的解析,但对非法字符没做处理了。

相关问题