Describe the bug
CCJSqlParserUtil.parse() misplaces the LIMIT clause when parsing a UNION query (tested both in the object structure and in the string output).
To Reproduce
Steps to reproduce the behavior:
- Example SQL:
select col from tbl
union distinct
select col2 from tbl
order by test limit 100;
- Parsing this SQL using JSqlParser results in the following statement (note that the LIMIT now shows before the ORDER BY, which is misplaced and causes a syntax error when using the query):
SELECT tbl.col FROM tbl
UNION DISTINCT
SELECT tbl.col2 FROM tbl
LIMIT 100 ORDER BY test
Expected behavior
The LIMIT should be shown after the ORDER BY clause
System
Tested on PostgreSQL, but I assume the same issue will occur for other databases such as MySQL, as the SQL syntax isn't valid.
Describe the bug
CCJSqlParserUtil.parse()misplaces the LIMIT clause when parsing a UNION query (tested both in the object structure and in the string output).To Reproduce
Steps to reproduce the behavior:
Expected behavior
The LIMIT should be shown after the ORDER BY clause
System
Tested on PostgreSQL, but I assume the same issue will occur for other databases such as MySQL, as the SQL syntax isn't valid.