提交 112c2247 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Do not parse ORDER and LIMIT in UPDATE clause of MERGE USING

上级 7601a29e
...@@ -1116,11 +1116,11 @@ public class Parser { ...@@ -1116,11 +1116,11 @@ public class Parser {
int start = lastParseIndex; int start = lastParseIndex;
TableFilter filter = readSimpleTableFilter(0, null); TableFilter filter = readSimpleTableFilter(0, null);
command.setTableFilter(filter); command.setTableFilter(filter);
parseUpdateSetClause(command, filter, start); parseUpdateSetClause(command, filter, start, true);
return command; return command;
} }
private void parseUpdateSetClause(Update command, TableFilter filter, int start) { private void parseUpdateSetClause(Update command, TableFilter filter, int start, boolean allowExtensions) {
read("SET"); read("SET");
if (readIf(OPEN_PAREN)) { if (readIf(OPEN_PAREN)) {
ArrayList<Column> columns = Utils.newSmallArrayList(); ArrayList<Column> columns = Utils.newSmallArrayList();
...@@ -1154,6 +1154,7 @@ public class Parser { ...@@ -1154,6 +1154,7 @@ public class Parser {
Expression condition = readExpression(); Expression condition = readExpression();
command.setCondition(condition); command.setCondition(condition);
} }
if (allowExtensions) {
if (readIf(ORDER)) { if (readIf(ORDER)) {
// for MySQL compatibility // for MySQL compatibility
// (this syntax is supported, but ignored) // (this syntax is supported, but ignored)
...@@ -1164,6 +1165,7 @@ public class Parser { ...@@ -1164,6 +1165,7 @@ public class Parser {
Expression limit = readTerm().optimize(session); Expression limit = readTerm().optimize(session);
command.setLimit(limit); command.setLimit(limit);
} }
}
setSQL(command, "UPDATE", start); setSQL(command, "UPDATE", start);
} }
...@@ -1513,7 +1515,7 @@ public class Parser { ...@@ -1513,7 +1515,7 @@ public class Parser {
updateCommand = new Update(session); updateCommand = new Update(session);
TableFilter filter = command.getTargetTableFilter(); TableFilter filter = command.getTargetTableFilter();
updateCommand.setTableFilter(filter); updateCommand.setTableFilter(filter);
parseUpdateSetClause(updateCommand, filter, startMatched); parseUpdateSetClause(updateCommand, filter, startMatched, false);
startMatched = lastParseIndex; startMatched = lastParseIndex;
} }
Delete deleteCommand = null; Delete deleteCommand = null;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论