提交 83697c14 authored 作者: Thomas Mueller's avatar Thomas Mueller

Issue 572: MySQL compatibility for "order by" in update statements.

上级 c364baf4
...@@ -747,16 +747,16 @@ public class Parser { ...@@ -747,16 +747,16 @@ public class Parser {
Expression condition = readExpression(); Expression condition = readExpression();
command.setCondition(condition); command.setCondition(condition);
} }
if (readIf("LIMIT")) {
Expression limit = readTerm().optimize(session);
command.setLimit(limit);
}
if (readIf("ORDER")) { if (readIf("ORDER")) {
// for MySQL compatibility // for MySQL compatibility
// (this syntax is supported, but ignored) // (this syntax is supported, but ignored)
read("BY"); read("BY");
parseSimpleOrderList(); parseSimpleOrderList();
} }
if (readIf("LIMIT")) {
Expression limit = readTerm().optimize(session);
command.setLimit(limit);
}
setSQL(command, "UPDATE", start); setSQL(command, "UPDATE", start);
return command; return command;
} }
......
...@@ -799,8 +799,7 @@ select count(*) from test; ...@@ -799,8 +799,7 @@ select count(*) from test;
> 3; > 3;
select max(col1) from test; select max(col1) from test;
> 3; > 3;
update test set col1 = col1 + 1 update test set col1 = col1 + 1 limit 1 order by col1 asc;
order by col1 asc;
select count(*) from test; select count(*) from test;
> 3; > 3;
select max(col1) from test; select max(col1) from test;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论