File tree Expand file tree Collapse file tree 2 files changed +28
-3
lines changed
main/jjtree/net/sf/jsqlparser/parser
test/java/net/sf/jsqlparser/expression Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -4796,9 +4796,7 @@ Expression CaseWhenExpression() #CaseWhenExpression:
4796
4796
[
4797
4797
<K_ELSE>
4798
4798
(
4799
- LOOKAHEAD(3, {!interrupted}) "(" elseExp=CaseWhenExpression() ")" { elseExp = new Parenthesis( elseExp ); }
4800
- | LOOKAHEAD(3, {!interrupted}) elseExp=CaseWhenExpression()
4801
- | LOOKAHEAD(3, {getAsBoolean(Feature.allowComplexParsing) && !interrupted}) elseExp=Expression()
4799
+ LOOKAHEAD({getAsBoolean(Feature.allowComplexParsing) && !interrupted}) elseExp=Expression()
4802
4800
| elseExp=SimpleExpression()
4803
4801
)
4804
4802
]
Original file line number Diff line number Diff line change @@ -82,6 +82,33 @@ public void testCaseOrSwitch() throws JSQLParserException {
82
82
TestUtils .assertExpressionCanBeParsedAndDeparsed ("CASE true OR false WHEN true THEN 1 ELSE 2 END" , true );
83
83
}
84
84
85
+ @ Test
86
+ public void testInnerCaseWithConcatInElsePart () throws JSQLParserException {
87
+ String query = "SELECT \n " +
88
+ "CASE \n " +
89
+ " WHEN 1 = 1 \n " +
90
+ " THEN \n " +
91
+ " CASE \n " +
92
+ " WHEN 2 = 2 \n " +
93
+ " THEN '2a' \n " +
94
+ " ELSE \n " +
95
+ " CASE \n " +
96
+ " WHEN 1 = 1 \n " +
97
+ " THEN \n " +
98
+ " CASE \n " +
99
+ " WHEN 2 = 2 \n " +
100
+ " THEN '2a' \n " +
101
+ " ELSE '' \n " +
102
+ " END \n " +
103
+ " ELSE 'b' \n " +
104
+ " END || 'z'\n " +
105
+ " END \n " +
106
+ " ELSE 'b' \n " +
107
+ "END AS tmp\n " +
108
+ "FROM test_table" ;
109
+ TestUtils .assertSqlCanBeParsedAndDeparsed (query , true );
110
+ }
111
+
85
112
@ Test
86
113
public void testCaseInsideBrackets () throws JSQLParserException {
87
114
String sqlStr = "SELECT ( CASE\n "
You can’t perform that action at this time.
0 commit comments