提交 c35140b8 authored 作者: thomasmueller's avatar thomasmueller

Merge branch 'master' of https://github.com/h2database/h2database

......@@ -838,7 +838,7 @@ public class TableFilter implements ColumnResolver {
} else {
first = false;
}
buff.append(index);
buff.append(Parser.quoteIdentifier(index));
}
buff.append(")");
}
......
......@@ -31,6 +31,7 @@ public class TestIndexHints extends TestBase {
public void test() throws Exception {
deleteDb("indexhints");
createDb();
testQuotedIdentifier();
testWithSingleIndexName();
testWithEmptyIndexHintsList();
testWithInvalidIndexName();
......@@ -47,6 +48,25 @@ public class TestIndexHints extends TestBase {
stat.execute("create table test (x int, y int)");
stat.execute("create index idx1 on test (x)");
stat.execute("create index idx2 on test (x, y)");
stat.execute("create index \"Idx3\" on test (y, x)");
}
private void testQuotedIdentifier() throws SQLException {
Connection conn = getConnection("indexhints");
Statement stat = conn.createStatement();
ResultSet rs = stat.executeQuery("explain analyze select * " +
"from test use index(\"Idx3\") where x=1 and y=1");
assertTrue(rs.next());
String plan = rs.getString(1);
rs.close();
assertTrue(plan.contains("/* PUBLIC.\"Idx3\":"));
assertTrue(plan.contains("USE INDEX (\"Idx3\")"));
rs = stat.executeQuery("EXPLAIN ANALYZE " + plan);
assertTrue(rs.next());
plan = rs.getString(1);
assertTrue(plan.contains("/* PUBLIC.\"Idx3\":"));
assertTrue(plan.contains("USE INDEX (\"Idx3\")"));
conn.close();
}
private void testWithSingleIndexName() throws SQLException {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论