Skip to content

Commit

Permalink
fix: issue #1948 Between with expression
Browse files Browse the repository at this point in the history
fixes #1948

Signed-off-by: Andreas Reichel <[email protected]>
  • Loading branch information
manticore-projects committed Feb 23, 2024
1 parent 94fb872 commit b9453f2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt
Original file line number Diff line number Diff line change
Expand Up @@ -3666,8 +3666,6 @@ Expression Between(Expression leftExpression) :
(
LOOKAHEAD( 3 ) betweenExpressionStart = ParenthesedSelect()
|
LOOKAHEAD( SimpleFunction() ) betweenExpressionStart = SimpleFunction()
|
LOOKAHEAD( RegularCondition() ) betweenExpressionStart = RegularCondition()
|
betweenExpressionStart = SimpleExpression()
Expand All @@ -3677,8 +3675,6 @@ Expression Between(Expression leftExpression) :
(
LOOKAHEAD( 3 ) betweenExpressionEnd = ParenthesedSelect()
|
LOOKAHEAD( SimpleFunction() ) betweenExpressionEnd = SimpleFunction()
|
LOOKAHEAD( RegularCondition() ) betweenExpressionEnd = RegularCondition()
|
betweenExpressionEnd = SimpleExpression()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package net.sf.jsqlparser.expression.operators.relational;

import net.sf.jsqlparser.JSQLParserException;
import net.sf.jsqlparser.test.TestUtils;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

class BetweenTest {
@Test
void testBetweenWithAdditionIssue1948() throws JSQLParserException {
String sqlStr = "select col FROM tbl WHERE start_time BETWEEN 1706024185 AND MyFunc() - 734400";
TestUtils.assertSqlCanBeParsedAndDeparsed(sqlStr, true);
}
}

0 comments on commit b9453f2

Please sign in to comment.