You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/09/28 05:02:36 UTC

[GitHub] [shardingsphere] strongduanmu opened a new issue, #21231: Wrong result return when execute openGauss `select limit 1, 2` statement with sql federation

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

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   https://github.com/apache/shardingsphere/commit/684eaa5d02978b54a3f63c8c3aa286bf4d590234
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-Proxy
   
   ### Expected behavior
   
   ```sql
   [ WITH [ RECURSIVE ] with_query [, ...] ]
   SELECT [/*+ plan_hint */] [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]
   { * | {expression [ [ AS ] output_name ]} [, ...] }
   [ FROM from_item [, ...] ]
   [ WHERE condition ]
   [ [ START WITH condition ] CONNECT BY [NOCYCLE] condition [ ORDER SIBLINGS BY expression ] ]
   [ GROUP BY grouping_element [, ...] ]
   [ HAVING condition [, ...] ]
   [ WINDOW {window_name AS ( window_definition )} [, ...] ]
   [ { UNION | INTERSECT | EXCEPT | MINUS } [ ALL | DISTINCT ] select ]
   [ ORDER BY {expression [ [ ASC | DESC | USING operator ] | nlssort_expression_clause ] [ NULLS { FIRST | LAST } ]} [, ...] ]
   [ LIMIT { [offset,] count | ALL } ]
   [ OFFSET start [ ROW | ROWS ] ]
   [ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ]
   [ {FOR { UPDATE | NO KEY UPDATE | SHARE | KEY SHARE } [ OF table_name [, ...] ] [ NOWAIT ]} [...] ];
   ```
   
   According to openGauss select limit sytax, this sql should result following result.
   
   ```sql
   sharding_db=> select * from test where aid > 0;
    aid | aname | bid | bname
   -----+-------+-----+-------
      2 | a     |   2 | b
      3 | a     |   3 | b
   (2 rows)
   
   sharding_db=> select * from test where aid > 0 limit 1, 2;
    aid | aname | bid | bname
   -----+-------+-----+-------
      3 | a     |   3 | b
   (1 rows)
   ```
   
   ### Actual behavior
   
   It seems that the SQL parsing engine parses count and offset incorrectly.
   
   ```sql
   sharding_db=> select * from test where aid > 0;
    aid | aname | bid | bname
   -----+-------+-----+-------
      2 | a     |   2 | b
      3 | a     |   3 | b
   (2 rows)
   
   sharding_db=> select * from test where aid > 0 limit 1, 2;
    aid | aname | bid | bname
   -----+-------+-----+-------
   (0 rows)
   ```
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] tristaZero closed issue #21231: Wrong result return when execute openGauss `select limit 1, 2` statement with sql federation

Posted by GitBox <gi...@apache.org>.
tristaZero closed issue #21231: Wrong result return when execute openGauss `select limit 1, 2` statement with sql federation
URL: https://github.com/apache/shardingsphere/issues/21231


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org