提交 1856e9bd authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

ON and FULL are keywords

上级 b606d039
...@@ -1364,7 +1364,7 @@ public class Parser { ...@@ -1364,7 +1364,7 @@ public class Parser {
command.setQuery(parseSelect()); command.setQuery(parseSelect());
read(CLOSE_PAREN); read(CLOSE_PAREN);
} }
String queryAlias = readFromAlias(null, Collections.singletonList("ON")); String queryAlias = readFromAlias(null, null);
if (queryAlias == null) { if (queryAlias == null) {
queryAlias = Constants.PREFIX_QUERY_ALIAS + parseIndex; queryAlias = Constants.PREFIX_QUERY_ALIAS + parseIndex;
} }
...@@ -1385,8 +1385,7 @@ public class Parser { ...@@ -1385,8 +1385,7 @@ public class Parser {
command.setSourceTableFilter(sourceTableFilter); command.setSourceTableFilter(sourceTableFilter);
} else { } else {
/* Its a table name, simulate a query by building a select query for the table */ /* Its a table name, simulate a query by building a select query for the table */
List<String> excludeIdentifiers = Collections.singletonList("ON"); TableFilter sourceTableFilter = readSimpleTableFilter(0, null);
TableFilter sourceTableFilter = readSimpleTableFilter(0, excludeIdentifiers);
command.setSourceTableFilter(sourceTableFilter); command.setSourceTableFilter(sourceTableFilter);
Select preparedQuery = new Select(session); Select preparedQuery = new Select(session);
...@@ -1764,7 +1763,8 @@ public class Parser { ...@@ -1764,7 +1763,8 @@ public class Parser {
private String readFromAlias(String alias, List<String> excludeIdentifiers) { private String readFromAlias(String alias, List<String> excludeIdentifiers) {
if (readIf("AS")) { if (readIf("AS")) {
alias = readAliasIdentifier(); alias = readAliasIdentifier();
} else if (currentTokenType == IDENTIFIER && !isTokenInList(excludeIdentifiers)) { } else if (currentTokenType == IDENTIFIER
&& (excludeIdentifiers == null || !isTokenInList(excludeIdentifiers))) {
alias = readAliasIdentifier(); alias = readAliasIdentifier();
} }
return alias; return alias;
...@@ -1773,7 +1773,7 @@ public class Parser { ...@@ -1773,7 +1773,7 @@ public class Parser {
private String readFromAlias(String alias) { private String readFromAlias(String alias) {
// left and right are not keywords (because they are functions as // left and right are not keywords (because they are functions as
// well) // well)
List<String> excludeIdentifiers = Arrays.asList("LEFT", "RIGHT", "FULL"); List<String> excludeIdentifiers = Arrays.asList("LEFT", "RIGHT");
return readFromAlias(alias, excludeIdentifiers); return readFromAlias(alias, excludeIdentifiers);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论