Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.36.0
Description
Here is a test case which shows that a recursive query becomes a non recursive query when cloned using SqlShuttle.
Copy paste the below test case in SqlParserTest
@Test void testRecursiveQueryCloned() throws Exception { SqlNode sqlNode = sql("with RECURSIVE emp2 as " + "(select * from emp union select * from emp2) select * from emp2").parser().parseStmt(); SqlNode sqlNode1 = sqlNode.accept(new SqlShuttle() { @Override public SqlNode visit(SqlIdentifier identifier) { return new SqlIdentifier(identifier.names, identifier.getParserPosition()); } }); System.out.println(sqlNode1.toSqlString(c -> c.withAlwaysUseParentheses(false)).getSql()); }
The above test case generates following output.
WITH "EMP2" AS (SELECT * FROM "EMP" UNION SELECT * FROM "EMP2") SELECT * FROM "EMP2"
Attachments
Issue Links
- links to