morningman opened a new pull request #3140: [Syntax] Remove all EmptyStmt from 
the end of multi-statements list
URL: https://github.com/apache/incubator-doris/pull/3140
 
 
   to resolve the ISSUE: #3139 
   
   When user execute query by some client library such as python MysqlDb, if 
user execute like:
   
        "select * from tbl1;"  (with a comma at the end of statement)
        
   The sql parser will produce 2 statements: `SelectStmt` and `EmptyStmt`.
   Here we discard the `EmptyStmt` to make it act like one single statement.
   
   This is for some compatibility. Because in python MysqlDb, if the first 
`SelectStmt` results in
   some warnings, it will try to execute a `SHOW WARNINGS` statement right 
after the 
   SelectStmt, but before the execution of `EmptyStmt`. So there will be an 
exception:
   
        `(2014, "Commands out of sync; you can't run this command now")`
   
   I though it is a flaw of python MysqlDb.
   However, in order to maintain the consistency of user use, here we remove 
all EmptyStmt
   at the end to prevent errors.(Leave at least one statement)
   
   But if user execute statements like:
   
        `"select * from tbl1;;select 2"`
        
   If first `select * from tbl1` has warnings, python MysqlDb will still throw 
exception.
   

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to