File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
main/javacc/net/sf/jsqlparser/parser
test/java/net/sf/jsqlparser/test/select Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -1555,7 +1555,7 @@ ExtractExpression ExtractExpression() :
15551555 "("
15561556 token=<S_IDENTIFIER> { retval.setName(token.image); }
15571557 <K_FROM>
1558- expr=PrimaryExpression () { retval.setExpression(expr); }
1558+ expr=SimpleExpression () { retval.setExpression(expr); }
15591559 ")"
15601560 {
15611561 return retval;
Original file line number Diff line number Diff line change @@ -763,6 +763,16 @@ public void testExtractFrom2() throws JSQLParserException {
763763 String stmt = "SELECT EXTRACT(year FROM now()) FROM testtable" ;
764764 assertSqlCanBeParsedAndDeparsed (stmt );
765765 }
766+
767+ public void testExtractFrom3 () throws JSQLParserException {
768+ String stmt = "SELECT EXTRACT(year FROM (now() - 2)) FROM testtable" ;
769+ assertSqlCanBeParsedAndDeparsed (stmt );
770+ }
771+
772+ public void testExtractFrom4 () throws JSQLParserException {
773+ String stmt = "SELECT EXTRACT(minutes FROM now() - '01:22:00') FROM testtable" ;
774+ assertSqlCanBeParsedAndDeparsed (stmt );
775+ }
766776
767777 public void testProblemFunction () throws JSQLParserException {
768778 String stmt = "SELECT test() FROM testtable" ;
You can’t perform that action at this time.
0 commit comments