merge sql error, dbType postgresql
Posted BigOrang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了merge sql error, dbType postgresql相关的知识,希望对你有一定的参考价值。
2020-03-02 15:39:08.501 ERROR 267704 --- [ main] c.alibaba.druid.filter.stat.StatFilter : merge sql error, dbType postgresql, druid-1.1.10, sql : create table if not exists ip_count_20200302 partition of ip_count for values from (20200302) to (20200303);
com.alibaba.druid.sql.parser.ParserException: syntax error, error in :‘0302 partition of ip_count ‘, expect IDENTIFIER, actual IDENTIFIER pos 72, line 1, column 63, token IDENTIFIER partition
at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:284) ~[druid-1.1.10.jar:1.1.10]
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:426) ~[druid-1.1.10.jar:1.1.10]
at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:72) ~[druid-1.1.10.jar:1.1.10]
at com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils.parameterize(ParameterizedOutputVisitorUtils.java:94) ~[druid-1.1.10.jar:1.1.10]
at com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils.parameterize(ParameterizedOutputVisitorUtils.java:77) ~[druid-1.1.10.jar:1.1.10]
at com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils.parameterize(ParameterizedOutputVisitorUtils.java:50) ~[druid-1.1.10.jar:1.1.10]
at com.alibaba.druid.filter.stat.StatFilter.mergeSql(StatFilter.java:147) [druid-1.1.10.jar:1.1.10]
at com.alibaba.druid.filter.stat.StatFilter.createSqlStat(StatFilter.java:648) [druid-1.1.10.jar:1.1.10]
SQL
#postgre分区
create table if not exists ip_count_20200302 partition of ip_count for values from (20200302) to (20200303);
可能问题:
从druid的issue来看,druid的merge不支持postgresql的 partition字段
解决办法
1.关闭mergeSQL功能
#springboot
spring.datasource.druid.filter.stat.merge-sql=false
2.忽略该error虽然报error.但是语句是可以执行成功的,请自行校验
以上是关于merge sql error, dbType postgresql的主要内容,如果未能解决你的问题,请参考以下文章