Skip to content

Exception thrown when using "filter" or "start" as alias names #1255

Closed
@Todd102030

Description

@Todd102030

Describe the bug
JSQLParser is throwing an unexpected token error with certain alias names, specifically "filter" and "start".

To Reproduce
Steps to reproduce the behavior:

  1. Example SQL
    select viID as r,
    lower(concat(vName,'[]',viItem,'[]',viDesc)) as filter
    from tVendorItem vi
    inner join vendorinfo v on vi.cn=v.cn and viVendor=v.vId
    inner join tUnits u on vi.cn=u.cn and vi.viUsageUM=u.uRow
    left join tVendorItemFamily vf on vi.cn=vf.cn and vi.viId=vf.Item and vf.Family=?
    where vi.cn=@cn and (viId=? or (find_in_set(vi.Purpose,?)>0 and viInactive=0 and vf.Family>0))
    order by vName,viItem

  2. Parsing this SQL using JSqlParser with this statements
    SimpleNode node = (SimpleNode) CCJSqlParserUtil.parseAST(sqlInput);

  3. Exception
    Encountered unexpected token: "filter" "FILTER"
    at line 2, column 52.

Expected behavior
Expected to parse the same as all the other alias names that I've tested

System

  • MySQL 8.0
  • Java Version - JDK 8
  • JSqlParser version - 4.1

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