Unverified 提交 d7bfc163 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov 提交者: GitHub

Merge pull request #1100 from katzyn/on_duplicate

Fix Insert.prepareUpdateCondition() for PageStore
......@@ -24,6 +24,7 @@ import org.h2.expression.ExpressionColumn;
import org.h2.expression.Parameter;
import org.h2.expression.SequenceValue;
import org.h2.index.Index;
import org.h2.index.PageDataIndex;
import org.h2.message.DbException;
import org.h2.mvstore.db.MVPrimaryIndex;
import org.h2.result.ResultInterface;
......@@ -423,11 +424,18 @@ public class Insert extends Prepared implements ResultTarget {
// It returns all of the columns in the table when we call
// getIndexColumns() or getColumns().
// Don't have time right now to fix that, so just special-case it.
// PageDataIndex has the same problem.
final Column[] indexedColumns;
if (foundIndex instanceof MVPrimaryIndex) {
MVPrimaryIndex foundMV = (MVPrimaryIndex) foundIndex;
indexedColumns = new Column[] { foundMV.getIndexColumns()[foundMV
.getMainIndexColumn()].column };
} else if (foundIndex instanceof PageDataIndex) {
PageDataIndex foundPD = (PageDataIndex) foundIndex;
int mainIndexColumn = foundPD.getMainIndexColumn();
indexedColumns = mainIndexColumn >= 0
? new Column[] { foundPD.getIndexColumns()[mainIndexColumn].column }
: foundIndex.getColumns();
} else {
indexedColumns = foundIndex.getColumns();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论