Skip to content

[BUG] JSQLParser Version : 5.1-SNAPSHOT : select count(*) fails in simple mode #2059

@serge-rider

Description

@serge-rider

Failing SQL Feature:

In JSQLParser 5.x.

If run run with disabled complex parsing it fails on trivial queries if they contain func(*).

(we cannot enable complex parsing because parser still hangs on queries with big number of brackets).

Java snippet:

    public static void main(String[] args) throws Exception {
        CCJSqlParser parser = new CCJSqlParser(new StringProvider("select count(*) from zzz"));
        parser.withAllowComplexParsing(false);
        parser.Statement();
   }

Fails with error

Exception in thread "main" net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "(" "("
    at line 1, column 13.

Was expecting one of:

    "."
    "::"
    "^"
    <EOF>
    <ST_SEMICOLON>

	at net.sf.jsqlparser.parser.CCJSqlParser.generateParseException(CCJSqlParser.java:42285)
	at net.sf.jsqlparser.parser.CCJSqlParser.jj_consume_token(CCJSqlParser.java:42106)
	at net.sf.jsqlparser.parser.CCJSqlParser.Statement(CCJSqlParser.java:341)

SQL Example:

Parser fails if query contains any functions call with asterisk (e.g. count(*) or func_name(*))

Looks like a quite serious issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions