zhouqingqing / qpmodel

A Relational Optimizer and Executor
MIT License
66 stars 18 forks source link

REPEAT of SUBSTRING of CONCAT fails #214

Closed pkommoju closed 4 years ago

pkommoju commented 4 years ago

select repeat((substring('Pacific South', 9, 13) || ' Pack' || 'ard'), 3) from a;

select substring(upper('mat') || upper('he') || upper('mat') || upper('ics'), 3, 8) from a;

Fail in the parser: Unhandled exception. qpmodel.sqlparser.AntlrParserException: expr->result_column->select_core->select_stmt->sql_stmt->sql_stmt_list->parse : 1|50|[@17,50:51='||',<14>,1:50]|no viable alternative at input 'repeat((substring('Pacific South', 9, 13) ||' at qpmodel.sqlparser.SyntaxErrorListener.SyntaxError(IRecognizer recognizer, IToken offendingSymbol, Int32 line, Int32 charPositionInLine, String msg, RecognitionException e) in D:\qpmodel\qpmodel\SQLParser.cs:line 55 at Antlr4.Runtime.ProxyErrorListener`1.SyntaxError(IRecognizer recognizer, Symbol offendingSymbol, Int32 line, Int32 charPositionInLine, String msg, RecognitionException e) at Antlr4.Runtime.Parser.NotifyErrorListeners(IToken offendingToken, String msg, RecognitionException e) at Antlr4.Runtime.DefaultErrorStrategy.NotifyErrorListeners(Parser recognizer, String message, RecognitionException e)

Earlier (Aug 28, 2020) the failure was in ExecSQL.().

Another related one, possibly the problem is in SUBSTRING.

select substring(upper('mat') || upper('he') || upper('mat') || upper('ics'), 3, 8) from a;