提交 07642478 authored 作者: Thomas Mueller's avatar Thomas Mueller

Linked tables did not work when a function-based index is present (Oracle).

上级 be7b6d67
......@@ -20,7 +20,8 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>Creating a user with a null password, salt, or hash threw a NullPointerException.
<ul><li>Linked tables did not work when a function-based index is present (Oracle).
</li><li>Creating a user with a null password, salt, or hash threw a NullPointerException.
</li><li>Foreign key: don't add a single column index if column
is leading key of existing index.
</li><li>Pull request #4: Creating and removing temporary tables was getting
......
......@@ -14,6 +14,7 @@ import java.sql.Statement;
import java.sql.Types;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.h2.api.ErrorCode;
import org.h2.command.Prepared;
......@@ -334,7 +335,19 @@ public class TableLink extends Table {
return columnName;
}
private void addIndex(ArrayList<Column> list, IndexType indexType) {
private void addIndex(List<Column> list, IndexType indexType) {
// bind the index to the leading recognized columns in the index
// (null columns might come from a function-based index)
int firstNull = list.indexOf(null);
if (firstNull == 0) {
trace.info("Omitting linked index - no recognized columns.");
return;
} else if (firstNull > 0) {
trace.info("Unrecognized columns in linked index. " +
"Registering the index against the leading {0} " +
"recognized columns of {1} total columns.", firstNull, list.size());
list = list.subList(0, firstNull);
}
Column[] cols = new Column[list.size()];
list.toArray(cols);
Index index = new LinkedIndex(this, 0, IndexColumn.wrap(cols), indexType);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论