pengxianggui opened a new issue, #23321:
URL: https://github.com/apache/shardingsphere/issues/23321

   ### Which version of ShardingSphere did you use?
   shardingshpere-jdbc-5.3.0
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   ### Expected behavior
   When I query the second page, I expect the sql to be `limit 10, 10`
   ### Actual behavior
   When I query the second page, the actual sql executed is `limit 0, 20`
   ### Reason analyze (If you can)
   I don't know. I think it might be a bug. This can only happen if routed to 
multiple tables.
   
   Here is my log:
   When routing to only one table: 
   ```
   2023-01-04 13:00:33.236  [[TID: N/A]] [http-nio-8082-exec-4] INFO 84221 
ShardingSphere-SQL -Actual SQL: db0 ::: select  
           a.id id, a.report_time, a.alarm_time, a.level, a.type,
           a.name, a.remark, a.longitude, a.latitude, a.address,
           a.responsible, a.responsible_phone, a.contact, a.contact_phone,
           a.from_where, a.from_where_code, a.from_where_remark, a.if_pre, 
a.domain_code,
           h.id handle_id, h.handler, h.handle_time, h.handle_type, 
h.handle_advice, h.alarm_id,
           h.if_enable_emergency_res, h.emergency_res_review, h.attachment_url, 
h.handle_source
         from t_alarm_2022 a
           left join t_alarm_handle_2022 h on a.id = h.alarm_id
           where
                1 = 1
               and a.alarm_time >= ?
               and a.alarm_time <= ?
               and h.id is null
               and a.if_pre = ?
            order by alarm_time desc LIMIT ?,? ::: [2022-07-08T11:00:48.685, 
2022-12-04T11:00:48.685, false, 20, 10]
   ```
   When routing to two tables:
   ```
   2023-01-04 13:02:26.574  [[TID: N/A]] [http-nio-8082-exec-6] INFO 84221 
ShardingSphere-SQL -Actual SQL: db0 ::: select  
           a.id id, a.report_time, a.alarm_time, a.level, a.type,
           a.name, a.remark, a.longitude, a.latitude, a.address,
           a.responsible, a.responsible_phone, a.contact, a.contact_phone,
           a.from_where, a.from_where_code, a.from_where_remark, a.if_pre, 
a.domain_code,
           h.id handle_id, h.handler, h.handle_time, h.handle_type, 
h.handle_advice, h.alarm_id,
           h.if_enable_emergency_res, h.emergency_res_review, h.attachment_url, 
h.handle_source
         from t_alarm_2022 a
           left join t_alarm_handle_2022 h on a.id = h.alarm_id
           where
               1 = 1
               and a.alarm_time >= ?
               and a.alarm_time <= ?
               and h.id is null
               and a.if_pre = ?
            order by alarm_time desc LIMIT ?,? ::: [2022-07-08T11:00:48.685, 
2023-01-04T11:00:48.685, false, 0, 30]
   2023-01-04 13:02:26.575  [[TID: N/A]] [http-nio-8082-exec-6] INFO 84221 
ShardingSphere-SQL -Actual SQL: db0 ::: select  
           a.id id, a.report_time, a.alarm_time, a.level, a.type,
           a.name, a.remark, a.longitude, a.latitude, a.address,
           a.responsible, a.responsible_phone, a.contact, a.contact_phone,
           a.from_where, a.from_where_code, a.from_where_remark, a.if_pre, 
a.domain_code,
           h.id handle_id, h.handler, h.handle_time, h.handle_type, 
h.handle_advice, h.alarm_id,
           h.if_enable_emergency_res, h.emergency_res_review, h.attachment_url, 
h.handle_source
         from t_alarm_2023 a
           left join t_alarm_handle_2023 h on a.id = h.alarm_id
           where
               1 = 1
               and a.alarm_time >= ?
               and a.alarm_time <= ?
               and h.id is null
               and a.if_pre = ?
            order by alarm_time desc LIMIT ?,? ::: [2022-07-08T11:00:48.685, 
2023-01-04T11:00:48.685, false, 0, 30]
   ```
   **Note the actual parameter after limit**


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to