Skip to content

Commit 51c92d8

Browse files
committed
fixes #862
1 parent 1ecfcbc commit 51c92d8

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Also I would like to know about needed examples or documentation stuff.
6565

6666
## Extensions in the latest SNAPSHOT version 3.1
6767

68+
* allow more complex expressions for **CASE**.
6869
* allowed **start** as object name as column name or table name
6970
* introduced more positions for **!** instead of **NOT**
7071
* allowed more complex expressions within **if** function

src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3234,7 +3234,7 @@ Expression CaseWhenExpression() #CaseWhenExpression:
32343234
(
32353235
( clause=WhenThenSearchCondition() { whenClauses.add(clause); } )+
32363236
|
3237-
(LOOKAHEAD(RegularCondition()) switchExp=RegularCondition() | switchExp=BitwiseAndOr())
3237+
switchExp=Condition()
32383238
( clause=WhenThenValue() { whenClauses.add(clause); } )+
32393239
)
32403240
[<K_ELSE> elseExp=Condition()]

src/test/java/net/sf/jsqlparser/statement/select/SelectTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,6 +1297,11 @@ public void testIssue235SimplifiedCase3() throws JSQLParserException {
12971297
public void testIssue235SimplifiedCase4() throws JSQLParserException {
12981298
assertSqlCanBeParsedAndDeparsed("SELECT CASE WHEN (CASE WHEN (CASE WHEN (CASE WHEN (1) THEN 0 END) THEN 0 END) THEN 0 END) THEN 0 END FROM a");
12991299
}
1300+
1301+
@Test
1302+
public void testIssue862CaseWhenConcat() throws JSQLParserException {
1303+
assertSqlCanBeParsedAndDeparsed("SELECT c1, CASE c1 || c2 WHEN '091' THEN '2' ELSE '1' END AS c11 FROM T2");
1304+
}
13001305

13011306
@Test
13021307
public void testReplaceAsFunction() throws JSQLParserException {

0 commit comments

Comments
 (0)