Skip to content

Commit 9c2cc2c

Browse files
committed
fixes #456
1 parent 6b45218 commit 9c2cc2c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ String RelObjectNameExt2():
915915
String result=null;
916916
}
917917
{
918-
( result=RelObjectNameExt() | tk=<K_TOP>)
918+
( result=RelObjectNameExt() | tk=<K_TOP> | tk=<K_FROM> )
919919
{
920920
if (tk!=null) result=tk.image;
921921
return result;
@@ -2357,10 +2357,10 @@ Expression PrimaryExpression():
23572357

23582358
JdbcNamedParameter JdbcNamedParameter() : {
23592359
JdbcNamedParameter parameter = new JdbcNamedParameter();
2360-
Token token;
2360+
String name;
23612361
}
23622362
{
2363-
":" token=<S_IDENTIFIER> { parameter.setName(token.image); }
2363+
":" (name=RelObjectNameExt2() { parameter.setName(name); })
23642364
{
23652365
return parameter;
23662366
}

src/test/java/net/sf/jsqlparser/test/select/SelectTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2022,6 +2022,10 @@ public void testNamedParameter2() throws JSQLParserException {
20222022
assertEquals("param2", namedParameter2.getName());
20232023
assertEquals("param3", namedParameter3.getName());
20242024
}
2025+
2026+
public void testNamedParameter3() throws JSQLParserException {
2027+
assertSqlCanBeParsedAndDeparsed("SELECT * FROM t WHERE c = :from");
2028+
}
20252029

20262030
public void testComplexUnion1() throws IOException, JSQLParserException {
20272031
String stmt = "(SELECT 'abc-' || coalesce(mytab.a::varchar, '') AS a, mytab.b, mytab.c AS st, mytab.d, mytab.e FROM mytab WHERE mytab.del = 0) UNION (SELECT 'cde-' || coalesce(mytab2.a::varchar, '') AS a, mytab2.b, mytab2.bezeichnung AS c, 0 AS d, 0 AS e FROM mytab2 WHERE mytab2.del = 0)";

0 commit comments

Comments
 (0)