From 1a9173f7d65a0262b585f473074ac617ab8b592a Mon Sep 17 00:00:00 2001 From: Tobias Warneke Date: Wed, 30 Jun 2021 23:50:28 +0200 Subject: [PATCH] fixes #1140 --- .../jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt | 8 ++++---- .../net/sf/jsqlparser/statement/select/SelectTest.java | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt b/src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt index dcabd3c65..5fd6b8214 100644 --- a/src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt +++ b/src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt @@ -734,7 +734,7 @@ ResetStatement Reset(): { Token all; } { - ( LOOKAHEAD(2) {name = "Time Zone"; } | name = RelObjectNameExt() | all = {name = all.image; } ) + ( LOOKAHEAD(2) {name = "Time Zone"; } | name = RelObjectName() | all = {name = all.image; } ) { reset = new ResetStatement(name); } { return reset; } } @@ -1473,7 +1473,7 @@ String RelObjectNameExt(): String result=null; } { - ( result=RelObjectName() | tk= | tk= | tk= + ( result=RelObjectName() | tk= | tk= | tk= | tk= | tk= | tk= | tk= | tk= | tk= | tk= | tk= | tk= | tk= | tk= ) @@ -3194,7 +3194,7 @@ Expression ComparisonItem() : } { ( - retval=AllComparisonExpression() + LOOKAHEAD(3) retval=AllComparisonExpression() | LOOKAHEAD(3) retval=AnyComparisonExpression() | LOOKAHEAD(ValueListExpression()) retval=ValueListExpression() | LOOKAHEAD(3) retval=SimpleExpression() @@ -4531,7 +4531,7 @@ ColDataType ColDataType(): | tk= { colDataType.setDataType(tk.image);} ) - [LOOKAHEAD(2) "(" {tk2 =null;} ( (tk= [ tk2= | tk2= ] | tk= | tk= | tk= ) + [LOOKAHEAD(2) "(" {tk2 =null;} ( ( ( tk= [ LOOKAHEAD(2) (tk2= | tk2=) ] ) | tk= | tk= | tk= ) { argumentsStringList.add(tk.image + (tk2!=null?" " + tk2.image:"")); } ["," {/*argumentsStringList.add(",");*/}] )* ")"] [( "[" {tk=null;} [ tk= ] { array.add(tk!=null?Integer.valueOf(tk.image):null); } "]" )+ { colDataType.setArrayData(array); } ] [LOOKAHEAD(2) tk= { colDataType.setCharacterSet(tk.image); } ] diff --git a/src/test/java/net/sf/jsqlparser/statement/select/SelectTest.java b/src/test/java/net/sf/jsqlparser/statement/select/SelectTest.java index 723f9ef62..948d79331 100644 --- a/src/test/java/net/sf/jsqlparser/statement/select/SelectTest.java +++ b/src/test/java/net/sf/jsqlparser/statement/select/SelectTest.java @@ -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[])"); + } }