提交 367cb540 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Forbid additional index conditions in MERGE USING

上级 7e2ec608
...@@ -318,6 +318,7 @@ public class MergeUsing extends Prepared { ...@@ -318,6 +318,7 @@ public class MergeUsing extends Prepared {
// Prepare each of the sub-commands ready to aid in the MERGE // Prepare each of the sub-commands ready to aid in the MERGE
// collaboration // collaboration
targetTableFilter.doneWithIndexConditions();
if (updateCommand != null) { if (updateCommand != null) {
updateCommand.setSourceTableFilter(sourceTableFilter); updateCommand.setSourceTableFilter(sourceTableFilter);
updateCommand.setCondition(appendOnCondition(updateCommand)); updateCommand.setCondition(appendOnCondition(updateCommand));
......
...@@ -82,6 +82,11 @@ public class TableFilter implements ColumnResolver { ...@@ -82,6 +82,11 @@ public class TableFilter implements ColumnResolver {
*/ */
private final ArrayList<IndexCondition> indexConditions = Utils.newSmallArrayList(); private final ArrayList<IndexCondition> indexConditions = Utils.newSmallArrayList();
/**
* Whether new window conditions should not be accepted.
*/
private boolean doneWithIndexConditions;
/** /**
* Additional conditions that can't be used for index lookup, but for row * Additional conditions that can't be used for index lookup, but for row
* filter for this table (ID=ID, NAME LIKE '%X%') * filter for this table (ID=ID, NAME LIKE '%X%')
...@@ -627,7 +632,16 @@ public class TableFilter implements ColumnResolver { ...@@ -627,7 +632,16 @@ public class TableFilter implements ColumnResolver {
* @param condition the index condition * @param condition the index condition
*/ */
public void addIndexCondition(IndexCondition condition) { public void addIndexCondition(IndexCondition condition) {
indexConditions.add(condition); if (!doneWithIndexConditions) {
indexConditions.add(condition);
}
}
/**
* Used to reject all additional index conditions.
*/
public void doneWithIndexConditions() {
this.doneWithIndexConditions = true;
} }
/** /**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论