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/05/30 23:53:34 UTC

[GitHub] [shardingsphere] arungopalan opened a new issue, #18078: Handling of star in select statement

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

   The postgresql parser seems to parse this without giving any error
   
   `select * as some_col from some_table`
   
   A * is not allowed to have aliases in postgresql.
   
   Weirdly, postgresql allows an alias after a dot star. So a query like this is allowed `select t.* as some_col from some_table t`. The alias is ignored in this case.


-- 
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] arungopalan commented on issue #18078: Handling of star in select statement

Posted by GitBox <gi...@apache.org>.
arungopalan commented on issue #18078:
URL: https://github.com/apache/shardingsphere/issues/18078#issuecomment-1141545395

   
   
   
   See code below that can reproduce this. This produces no error but it should.
   
   ```
   package com.somepackage;
   
   import org.antlr.v4.runtime.CharStreams;
   import org.antlr.v4.runtime.CommonTokenStream;
   import org.antlr.v4.runtime.ParserRuleContext;
   import org.antlr.v4.runtime.tree.ErrorNode;
   import org.antlr.v4.runtime.tree.ParseTreeListener;
   import org.antlr.v4.runtime.tree.ParseTreeWalker;
   import org.antlr.v4.runtime.tree.TerminalNode;
   import org.apache.shardingsphere.sql.parser.postgresql.parser.PostgreSQLLexer;
   import org.apache.shardingsphere.sql.parser.postgresql.parser.PostgreSQLParser;
   
   /**
    * Hello world!
    *
    */
   public class App 
   {
       public static void main( String[] args )
       {
           String query = "select * as ab from some_table";
           PostgreSQLLexer postgreSQLLexer = new PostgreSQLLexer(CharStreams.fromString(query));
           PostgreSQLParser postgreSQLParser = new PostgreSQLParser(new CommonTokenStream(postgreSQLLexer));
           ParseTreeWalker parseTreeWalker = new ParseTreeWalker();
   
           parseTreeWalker.walk(new ParseTreeListener() {
   
               @Override
               public void visitTerminal(TerminalNode node) {
                   System.out.println("Terminal [" + node.getText() + "]");               
               }
   
               @Override
               public void visitErrorNode(ErrorNode node) {
                   System.out.println("Error [" + node + "]");               
               }
   
               @Override
               public void enterEveryRule(ParserRuleContext ctx) {
                   // System.out.println("Entering [" + ctx + "]");
                   
               }
   
               @Override
               public void exitEveryRule(ParserRuleContext ctx) {
                   // System.out.println("Exiting [" + ctx.getText() + "]");
               }
               
           }, postgreSQLParser.execute());
       }
   }
   ```


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


[GitHub] [shardingsphere] terrymanu closed issue #18078: Handling of star in select statement

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #18078: Handling of star in select statement
URL: https://github.com/apache/shardingsphere/issues/18078


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


[GitHub] [shardingsphere] terrymanu commented on issue #18078: Handling of star in select statement

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #18078:
URL: https://github.com/apache/shardingsphere/issues/18078#issuecomment-1159480059

   Yes, the alias of star may not parse yet, does anyone want to fix it?


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


[GitHub] [shardingsphere] zrsaber commented on issue #18078: Handling of star in select statement

Posted by GitBox <gi...@apache.org>.
zrsaber commented on issue #18078:
URL: https://github.com/apache/shardingsphere/issues/18078#issuecomment-1178705617

   please assign it to me, i will have a try


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


[GitHub] [shardingsphere] strongduanmu commented on issue #18078: Handling of star in select statement

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #18078:
URL: https://github.com/apache/shardingsphere/issues/18078#issuecomment-1178719443

   Welcome @zrsaber, I will assign this issue to you.


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