Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt
Original file line number Diff line number Diff line change
Expand Up @@ -9559,6 +9559,7 @@ Function InternalFunction(boolean escaped):
Expression expr = null;
Expression attributeExpression = null;
Column attributeColumn = null;
Token attributeToken = null;
Limit limit;
List<Function.KeywordArgument> keywordArgs = null;
}
Expand Down Expand Up @@ -9624,14 +9625,24 @@ Function InternalFunction(boolean escaped):
]


[ LOOKAHEAD(2) "." (
// tricky lookahead since we do need to support the following constructs
// schema.f1().f2() - Function with Function Column
// schema.f1().f2.f3 - Function with Attribute Column
LOOKAHEAD( 6 ) attributeExpression=Function() { retval.setAttribute(attributeExpression); }
[
LOOKAHEAD(2)
(
LOOKAHEAD({ getToken(1).kind == S_DOUBLE
&& getToken(1).image.matches("\\.[0-9]+") })
Comment on lines +9631 to +9632
attributeToken=<S_DOUBLE> {
retval.setAttribute(new LongValue(attributeToken.image.substring(1)));
}
|
attributeColumn=Column() { retval.setAttribute(attributeColumn); }
)
"." (
// tricky lookahead since we do need to support the following constructs
// schema.f1().f2() - Function with Function Column
// schema.f1().f2.f3 - Function with Attribute Column
LOOKAHEAD( 6 ) attributeExpression=Function() { retval.setAttribute(attributeExpression); }
|
attributeColumn=Column() { retval.setAttribute(attributeColumn); }
)
)
]

[ LOOKAHEAD(2) (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ public void testFunctionWithAttributesIssue1742() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed(sql, true);
}

@Test
public void testTuplePositionalAccessIssue2442() throws JSQLParserException {
String sql = "SELECT tuple(1, 2, 3).2 FROM tuple_demo";
assertSqlCanBeParsedAndDeparsed(sql, true);
}

@Test
public void testGlobalIn() throws JSQLParserException {
String sql =
Expand Down
Loading