提交 43d448d4 authored 作者: Noel Grandin's avatar Noel Grandin

MVPrimaryIndex needs special treatment here

because it reports it's data columns when I call getColumns(), which is not strictly true, I need the key columns
上级 8e8bc2bc
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
package org.h2.command.dml; package org.h2.command.dml;
import java.util.ArrayList; import java.util.ArrayList;
import org.h2.api.ErrorCode; import org.h2.api.ErrorCode;
import org.h2.api.Trigger; import org.h2.api.Trigger;
import org.h2.command.Command; import org.h2.command.Command;
...@@ -21,9 +20,11 @@ import org.h2.expression.Expression; ...@@ -21,9 +20,11 @@ import org.h2.expression.Expression;
import org.h2.expression.Parameter; import org.h2.expression.Parameter;
import org.h2.index.Index; import org.h2.index.Index;
import org.h2.message.DbException; import org.h2.message.DbException;
import org.h2.mvstore.db.MVPrimaryIndex;
import org.h2.result.ResultInterface; import org.h2.result.ResultInterface;
import org.h2.result.Row; import org.h2.result.Row;
import org.h2.table.Column; import org.h2.table.Column;
import org.h2.table.IndexColumn;
import org.h2.table.Table; import org.h2.table.Table;
import org.h2.table.TableFilter; import org.h2.table.TableFilter;
import org.h2.value.Value; import org.h2.value.Value;
...@@ -181,7 +182,14 @@ public class Merge extends CommandWithValues { ...@@ -181,7 +182,14 @@ public class Merge extends CommandWithValues {
Index index = (Index) e.getSource(); Index index = (Index) e.getSource();
if (index != null) { if (index != null) {
// verify the index columns match the key // verify the index columns match the key
Column[] indexColumns = index.getColumns(); Column[] indexColumns;
if (index instanceof MVPrimaryIndex) {
MVPrimaryIndex foundMV = (MVPrimaryIndex) index;
indexColumns = new Column[] {
foundMV.getIndexColumns()[foundMV.getMainIndexColumn()].column };
} else {
indexColumns = index.getColumns();
}
boolean indexMatchesKeys; boolean indexMatchesKeys;
if (indexColumns.length <= keys.length) { if (indexColumns.length <= keys.length) {
indexMatchesKeys = true; indexMatchesKeys = true;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论