Skip to content

Illegal table aliases in JSQLParser 4.4 #1572

@rolfwoll

Description

@rolfwoll

Hi,

After upgrade to 4.4 from 3.1 I got some exceptions in some of my legal Mariadb SQL queries. After a bit of investigation, it turns out that some table aliases gives a parsing exception. The ones I can see which I think should be legal are rr,rs and ur.

I tested in on 4.3, and it works in 4.3.

Failing test

    @Test
    public void failingSQLURAlias() throws Exception {
        String query = "select * from some_table ur\n";
        CCJSqlParserUtil.parse(query);
    }

    @Test
    public void failingSqlRRAlias() throws Exception {
        String query = "select * from some_table rr\n";
        CCJSqlParserUtil.parse(query);
    }

    @Test
    public void failingSqlRSAlias() throws Exception {
        String query = "select * from some_table rs\n";
        CCJSqlParserUtil.parse(query);
    }

Each of the tests give a parsing error like this:

net.sf.jsqlparser.JSQLParserException: Encountered unexpected token: "rs" <K_ISOLATION>
    at line 1, column 26.

Was expecting one of:

    ";"
    "ACTION"
    "ACTIVE"
    "ALGORITHM"
    "ARCHIVE"
    "ARRAY"
    "AS"
    "AT"
    "BYTE"
    "CASCADE"
    "CASE"
    ......

Regards
Rolf Woll

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