Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[BUG] JSQLParser Version 4.6 and beyond failing to parse SQL with three or more line breaks in the statement #2000

Closed
thebiguno opened this issue Apr 30, 2024 · 1 comment

Comments

@thebiguno
Copy link
Contributor

thebiguno commented Apr 30, 2024

Failing SQL Feature:

  • Version 4.6 and beyond seems to fail to parse some statements with three or more newlines in them.
  • Example: SELECT\n\n\nFOO1\nFROM FOO can't be parsed in 4.6 and beyond, but it could in 4.5.

SQL Example:

  • Simplified Query Example, focusing on the failing feature
SELECT
  
 
FOO1
FROM FOO

If you take out one of the new lines, it works:

SELECT

FOO1
FROM FOO

The error happens with the extra newlines in many positions, not just in the select list. This is just one of the simplest queries that I found which reproduces the problem.

Software Information:

  • JSqlParser version 4.5 works, version 4.6 and beyond does not. I tested 4.6, 4.9, and the latest snapshot (commit b815601)

The test class that I am running is just two lines of code plus the surrounding boilerplate:

package ca.richer.phoebie;

import net.sf.jsqlparser.parser.CCJSqlParserUtil;

public class SQLParserTest {

	public static void main(String[] args) throws Exception {
		final String sql = "SELECT\n\n\n\nFOO1\nFROM FOO";
		CCJSqlParserUtil.parse(sql);
	}
}

We use JSqlParser to parse many reports prior to modification and execution, and many of them have extra whitespace like this.

@manticore-projects
Copy link
Contributor

Please see #1988
Duplicate #1988

@manticore-projects manticore-projects closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants