Skip to content

Commit

Permalink
fixes #1140
Browse files Browse the repository at this point in the history
  • Loading branch information
wumpz committed Jun 30, 2021
1 parent aa304d6 commit 1a9173f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ ResetStatement Reset(): {
Token all;
}
{
<K_RESET> ( LOOKAHEAD(2) <K_DATETIMELITERAL> <K_ZONE> {name = "Time Zone"; } | name = RelObjectNameExt() | all = <K_ALL> {name = all.image; } )
<K_RESET> ( LOOKAHEAD(2) <K_DATETIMELITERAL> <K_ZONE> {name = "Time Zone"; } | name = RelObjectName() | all = <K_ALL> {name = all.image; } )
{ reset = new ResetStatement(name); }
{ return reset; }
}
Expand Down Expand Up @@ -1473,7 +1473,7 @@ String RelObjectNameExt():
String result=null;
}
{
( result=RelObjectName() | tk=<K_LEFT> | tk=<K_RIGHT> | tk=<K_SET>
( result=RelObjectName() | tk=<K_ALL> | tk=<K_LEFT> | tk=<K_RIGHT> | tk=<K_SET>
| tk=<K_DOUBLE> | tk=<K_IF> | tk=<K_IIF> | tk=<K_OPTIMIZE> | tk=<K_LIMIT>
| tk=<K_OFFSET> | tk=<K_PROCEDURE> | tk=<K_PUBLIC>
| tk=<K_CASEWHEN> | tk=<K_IN> )
Expand Down Expand Up @@ -3194,7 +3194,7 @@ Expression ComparisonItem() :
}
{
(
retval=AllComparisonExpression()
LOOKAHEAD(3) retval=AllComparisonExpression()
| LOOKAHEAD(3) retval=AnyComparisonExpression()
| LOOKAHEAD(ValueListExpression()) retval=ValueListExpression()
| LOOKAHEAD(3) retval=SimpleExpression()
Expand Down Expand Up @@ -4531,7 +4531,7 @@ ColDataType ColDataType():
| tk=<K_SIGNED> { colDataType.setDataType(tk.image);}
)

[LOOKAHEAD(2) "(" {tk2 =null;} ( (tk=<S_LONG> [ tk2=<K_BYTE> | tk2=<K_CHAR> ] | tk=<S_CHAR_LITERAL> | tk=<S_IDENTIFIER> | tk=<K_CHAR> )
[LOOKAHEAD(2) "(" {tk2 =null;} ( ( ( tk=<S_LONG> [ LOOKAHEAD(2) (tk2=<K_BYTE> | tk2=<K_CHAR>) ] ) | tk=<S_CHAR_LITERAL> | tk=<S_IDENTIFIER> | tk=<K_CHAR> )
{ argumentsStringList.add(tk.image + (tk2!=null?" " + tk2.image:"")); } ["," {/*argumentsStringList.add(",");*/}] )* ")"]
[( "[" {tk=null;} [ tk=<S_LONG> ] { array.add(tk!=null?Integer.valueOf(tk.image):null); } "]" )+ { colDataType.setArrayData(array); } ]
[LOOKAHEAD(2) <K_CHARACTER> <K_SET> tk=<S_IDENTIFIER> { colDataType.setCharacterSet(tk.image); } ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4629,4 +4629,13 @@ public void testMissinBracketsNestedInIssue() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed("SELECT COUNT(DISTINCT CASE WHEN room IN (11167, 12074, 4484, 4483, 6314, 11168, 10336, 16445, 13176, 13177, 13178) THEN uid END) AS uidCount from tableName", true);
}

@Test
public void testSelectAllOperatorIssue1140() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed("SELECT * FROM table t0 WHERE t0.id != all(5)");
}

@Test
public void testSelectAllOperatorIssue1140_2() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed("SELECT * FROM table t0 WHERE t0.id != all(?::uuid[])");
}
}

0 comments on commit 1a9173f

Please sign in to comment.