Mybatis-PageHelper icon indicating copy to clipboard operation
Mybatis-PageHelper copied to clipboard

When using multiple data sources, if an error occurs when querying one of the data sources, the SQL of the other data sources cannot automatically switch dialects to generate SQL

Open SoaringCode opened this issue 1 year ago • 4 comments

Caused by: org.postgresql.util.PSQLException: ERROR: LIMIT #,# syntax is not supported 建议:Use separate LIMIT and OFFSET clauses. 位置:420 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2733) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2420) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:372) at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:517) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:434) at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:194) at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:180) at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:497) at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:65) at com.mybatisflex.core.mybatis.FlexStatementHandler.query(FlexStatementHandler.java:101) at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:65) at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:336) at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:158) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:110) at com.github.pagehelper.util.ExecutorUtil.pageQuery(ExecutorUtil.java:215) at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:161) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:59) at jdk.proxy2/jdk.proxy2.$Proxy275.query(Unknown Source)

SoaringCode avatar Feb 19 '25 13:02 SoaringCode

https://github.com/pagehelper/Mybatis-PageHelper/blob/master/src/main/java/com/github/pagehelper/dialect/helper/PostgreSqlDialect.java

The dialect needs to be configured as postgresql.

abel533 avatar Feb 21 '25 02:02 abel533

helperDialect=postgresql

https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/en/HowToUse.md

abel533 avatar Feb 21 '25 02:02 abel533

helperDialect=postgresql

https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/en/HowToUse.md

We use multiple data sources, but when querying PostgreSQL's data pagination using MySQL as the main data source, an error occurs and we are unable to continue executing

SoaringCode avatar Feb 25 '25 13:02 SoaringCode

dynamic data sources in Spring and connect different types of databases https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/en/HowToUse.md#scene-5

LSL1618 avatar Feb 27 '25 03:02 LSL1618