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 2021/05/19 03:31:21 UTC

[GitHub] [shardingsphere] ThanoshanMV commented on a change in pull request #10381: Proofread Oracle `SELECT` subquery clause

ThanoshanMV commented on a change in pull request #10381:
URL: https://github.com/apache/shardingsphere/pull/10381#discussion_r634888075



##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DMLStatement.g4
##########
@@ -101,15 +101,19 @@ multipleTableNames
     ;
 
 select 
-    : unionClause
+    : selectSubquery forUpdateClause?
+    ;
+
+selectSubquery
+    : (selectClause | selectClause ((UNION ALL? | INTERSECT | MINUS) selectSubquery)+ | LP_ selectSubquery RP_) orderByClause? rowLimitingClause

Review comment:
       Yes @wgy8283335, `selectClause` refers to `queryBlock`, I'll rename `selectClause` to `queryBlock`. 
   
   When we specify `selectSubquery` as:
   ```
   selectSubquery
       : (queryBlock | selectSubquery ((UNION ALL? | INTERSECT | MINUS) selectSubquery)+ | LP_ selectSubquery RP_) orderByClause? rowLimitingClause
       ;
   ```
   ANTLR gives an error: `selectSubquery` is mutually left-recursive. 
   ![SelectSubquery-MutuallyLeftRecursive](https://user-images.githubusercontent.com/48581379/118752054-0be7d700-b880-11eb-869c-f63824d33da0.png)
   
   I think error is coming because of this one: `selectSubquery ((UNION ALL? | INTERSECT | MINUS) selectSubquery)+` 




-- 
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.

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