tristaZero opened a new issue #6417:
URL: https://github.com/apache/shardingsphere/issues/6417


   Hi community,
   This issue is to collate the SQL definitions of PostgreSQL. Therefore, we 
can support parsing more SQLs. 
   This issue needs your help. If you 
   1.Be familiar with `g4 file` of Antlr (The grammars are 
RegularExpression-like)
   2.Understand the `PostgreSQL grammars`
   then welcome!
   
   ### Background
   How is a SQL parsed?
   `SQL definition file` 
   ->(Parse to) 
   `AST`
   ->(Visit it)  
   `SQLStatment`
   
   
   
   
   ### Process
   1.Compare [Oficial SQL Doc](https://www.postgresql.org/docs/12/index.html) 
(Or [Source code](https://github.com/postgres/postgres/tree/REL_12_STABLE)) and 
[ShardingSphere SQL 
Doc](https://github.com/apache/shardingsphere/tree/master/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql)
   2. If there is any difference in ShardingSphere SQL Doc, please correct them 
referring to Official SQL Doc
   3. Run `mvn install the current_file_module` 
   4. Check whether there are any exceptions. If indeed, please fix them. 
(Especially `xxxVisitor.class`)
   5. Add new SQL case in [SQL 
Cases](https://github.com/apache/shardingsphere/tree/master/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/sql/supported)
 and expected parsed result in (Expected Statment 
XML)[https://github.com/apache/shardingsphere/tree/master/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/resources/case]
   6. Run 
[SQLParserParameterizedTest](https://github.com/apache/shardingsphere/blob/master/shardingsphere-sql-parser/shardingsphere-sql-parser-test/src/test/java/org/apache/shardingsphere/sql/parser/integrate/engine/SQLParserParameterizedTest.java)
 to make sure no exceptions.
   
   ### Notice
   1.`Left recursion` can not work well in Antlr4, 
   ```
   a
   : b
   | a b
   ;
   b
     : a c
     ;
   c
     : ...
     ;
   ```
   you can consider the following one,
   ```
   a
     : b*
     ;
   b
     : a c
     ;
   c
     : ...
     ;
   ```


----------------------------------------------------------------
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:
[email protected]


Reply via email to