select * from XX where crf_k @?? ?
@?是pg支持的操作符,,后面多加一个?是解决mybatis替换参数报错的问题,,最后一个?是占位符
3.错误输出 com.alibaba.druid.filter.stat.StatFilter : merge sql error, dbType postgresql, druid-1.2.8, sql : XXXXX com.alibaba.druid.sql.parser.ParserException: syntax error, expect ), actual VARIANT pos 494, line 12, column 37, token VARIANT at com.alibaba.druid.sql.parser.SQLExprParser.accept(SQLExprParser.java:4567) at com.alibaba.druid.sql.parser.SQLExprParser.primary(SQLExprParser.java:789) at com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser.primary(PGExprParser.java:152) at com.alibaba.druid.sql.parser.SQLExprParser.expr(SQLExprParser.java:96) at com.alibaba.druid.sql.parser.SQLSelectParser.parseWhere(SQLSelectParser.java:718) at com.alibaba.druid.sql.dialect.postgresql.parser.PGSelectParser.query(PGSelectParser.java:133) at com.alibaba.druid.sql.parser.SQLSelectParser.select(SQLSelectParser.java:61) at com.alibaba.druid.sql.dialect.postgresql.parser.PGSQLStatementParser.parseSelect(PGSQLStatementParser.java:418) at com.alibaba.druid.sql.dialect.postgresql.parser.PGSQLStatementParser.parseSelect(PGSQLStatementParser.java:30) at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:213) at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:114) at com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils.parameterize(ParameterizedOutputVisitorUtils.java:153) at com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils.parameterize(ParameterizedOutputVisitorUtils.java:126) at com.alibaba.druid.filter.stat.StatFilter.mergeSql(StatFilter.java:167) at com.alibaba.druid.filter.stat.StatFilter.createSqlStat(StatFilter.java:694) at com.alibaba.druid.filter.stat.StatFilter.statementPrepareAfter(StatFilter.java:344) at com.alibaba.druid.filter.FilterEventAdapter.connection_prepareStatement(FilterEventAdapter.java:124) at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:568) at com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl.prepareStatement(ConnectionProxyImpl.java:341)
2022-05-19 09:51:30,565 WARN --- [http-nio-8001-exec-1] - [ddb6bd6] com.alibaba.druid.sql.SQLUtils : rowFormat error com.alibaba.druid.sql.parser.ParserException: syntax error, expect ), actual VARIANT pos 494, line 12, column 37, token VARIANT at com.alibaba.druid.sql.parser.SQLExprParser.accept(SQLExprParser.java:4567) at com.alibaba.druid.sql.parser.SQLExprParser.primary(SQLExprParser.java:789) at com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser.primary(PGExprParser.java:152) at com.alibaba.druid.sql.parser.SQLExprParser.expr(SQLExprParser.java:96) at com.alibaba.druid.sql.parser.SQLSelectParser.parseWhere(SQLSelectParser.java:718) at com.alibaba.druid.sql.dialect.postgresql.parser.PGSelectParser.query(PGSelectParser.java:133) at com.alibaba.druid.sql.parser.SQLSelectParser.select(SQLSelectParser.java:61) at com.alibaba.druid.sql.dialect.postgresql.parser.PGSQLStatementParser.parseSelect(PGSQLStatementParser.java:418) at com.alibaba.druid.sql.dialect.postgresql.parser.PGSQLStatementParser.parseSelect(PGSQLStatementParser.java:30) at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:213) at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:114) at com.alibaba.druid.sql.SQLUtils.format(SQLUtils.java:346) at com.alibaba.druid.sql.SQLUtils.format(SQLUtils.java:339) at com.alibaba.druid.filter.logging.LogFilter.logExecutableSql(LogFilter.java:610) at com.alibaba.druid.filter.logging.LogFilter.statementExecuteAfter(LogFilter.java:507) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:442) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3459) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3459) at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:167) at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:497) at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)
1.环境 数据库:PG13.4 ORM: mybatis DRUID:1.2.8 2.sql,类似下面这种
select * from XX where crf_k @?? ?
@?是pg支持的操作符,,后面多加一个?是解决mybatis替换参数报错的问题,,最后一个?是占位符3.错误输出
com.alibaba.druid.filter.stat.StatFilter : merge sql error, dbType postgresql, druid-1.2.8, sql : XXXXX
com.alibaba.druid.sql.parser.ParserException: syntax error, expect ), actual VARIANT pos 494, line 12, column 37, token VARIANT at com.alibaba.druid.sql.parser.SQLExprParser.accept(SQLExprParser.java:4567) at com.alibaba.druid.sql.parser.SQLExprParser.primary(SQLExprParser.java:789) at com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser.primary(PGExprParser.java:152) at com.alibaba.druid.sql.parser.SQLExprParser.expr(SQLExprParser.java:96) at com.alibaba.druid.sql.parser.SQLSelectParser.parseWhere(SQLSelectParser.java:718) at com.alibaba.druid.sql.dialect.postgresql.parser.PGSelectParser.query(PGSelectParser.java:133) at com.alibaba.druid.sql.parser.SQLSelectParser.select(SQLSelectParser.java:61) at com.alibaba.druid.sql.dialect.postgresql.parser.PGSQLStatementParser.parseSelect(PGSQLStatementParser.java:418) at com.alibaba.druid.sql.dialect.postgresql.parser.PGSQLStatementParser.parseSelect(PGSQLStatementParser.java:30) at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:213) at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:114) at com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils.parameterize(ParameterizedOutputVisitorUtils.java:153) at com.alibaba.druid.sql.visitor.ParameterizedOutputVisitorUtils.parameterize(ParameterizedOutputVisitorUtils.java:126) at com.alibaba.druid.filter.stat.StatFilter.mergeSql(StatFilter.java:167) at com.alibaba.druid.filter.stat.StatFilter.createSqlStat(StatFilter.java:694) at com.alibaba.druid.filter.stat.StatFilter.statementPrepareAfter(StatFilter.java:344) at com.alibaba.druid.filter.FilterEventAdapter.connection_prepareStatement(FilterEventAdapter.java:124) at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:568) at com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl.prepareStatement(ConnectionProxyImpl.java:341)
2022-05-19 09:51:30,565 WARN --- [http-nio-8001-exec-1] - [ddb6bd6] com.alibaba.druid.sql.SQLUtils : rowFormat error com.alibaba.druid.sql.parser.ParserException: syntax error, expect ), actual VARIANT pos 494, line 12, column 37, token VARIANT at com.alibaba.druid.sql.parser.SQLExprParser.accept(SQLExprParser.java:4567) at com.alibaba.druid.sql.parser.SQLExprParser.primary(SQLExprParser.java:789) at com.alibaba.druid.sql.dialect.postgresql.parser.PGExprParser.primary(PGExprParser.java:152) at com.alibaba.druid.sql.parser.SQLExprParser.expr(SQLExprParser.java:96) at com.alibaba.druid.sql.parser.SQLSelectParser.parseWhere(SQLSelectParser.java:718) at com.alibaba.druid.sql.dialect.postgresql.parser.PGSelectParser.query(PGSelectParser.java:133) at com.alibaba.druid.sql.parser.SQLSelectParser.select(SQLSelectParser.java:61) at com.alibaba.druid.sql.dialect.postgresql.parser.PGSQLStatementParser.parseSelect(PGSQLStatementParser.java:418) at com.alibaba.druid.sql.dialect.postgresql.parser.PGSQLStatementParser.parseSelect(PGSQLStatementParser.java:30) at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:213) at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:114) at com.alibaba.druid.sql.SQLUtils.format(SQLUtils.java:346) at com.alibaba.druid.sql.SQLUtils.format(SQLUtils.java:339) at com.alibaba.druid.filter.logging.LogFilter.logExecutableSql(LogFilter.java:610) at com.alibaba.druid.filter.logging.LogFilter.statementExecuteAfter(LogFilter.java:507) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:442) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3459) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3459) at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:167) at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:497) at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)
我看有个类似的问题 以下pg语句执行通过,但是mergeSql里面报错了,可我用的是最新版本,还是有问题呢