Skip to content

[BUG] JSQLParser Version 4.7 : WithItems moved inside Select  #1895

@serhiizapalskyi

Description

@serhiizapalskyi

Failing SQL Feature:

I'm not sure is it a bug or feature, but unfortunately it breaks our current behavior. After migration from 4.5 to 4.7 the query WITH events as (select * from table1) select t1 from events is parsed with select body including WithItems. In previous versions Select.getSelectBody() was returning select without WithItems.

So Select.getSelectBody (I know it is deprecated) will result different in 4.5 and 4.7:
4.5: select t1 from events
4.7 WITH events as (select * from table1) select t1 from events

I see that Select structure was changed:
In 4.5 there was separately selectBody and withItems
In 4.7 withItems are included into select

The question:

Can I get select without WithItems (like it was in 4.5)?

SQL Example:

  • Simplified Query Example, focusing on the failing feature
          WITH events as (
                 select * from table1
           ) 
           select t1 
           from  events
    

Software Information:

  • JSqlParser version 4.7

Tips:

The same query has different structure in different versions of parser

4.5 Structure:

Screenshot 2023-11-22 at 13 44 45

4.7 Structure:

image

Thanks in advance,
Regards, Serhii Zapalskyi

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