提交 1b972af6 authored 作者: Thomas Mueller's avatar Thomas Mueller

Issue 323: NullPointerException when using IN(...) with a function table.

上级 53530856
......@@ -18,7 +18,8 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>Clob.toString() and Blob.toString() now include the trace identifier.
<ul><li>Issue 323: NullPointerException when using IN(...) with a function table.
</li><li>Clob.toString() and Blob.toString() now include the trace identifier.
</li><li>The SQL parser silently ignored characters such as '^' or '\'.
Now a syntax error is thrown.
</li><li>ROUND(..) now also works with just one parameter.
......
......@@ -79,7 +79,7 @@ public class CreateView extends SchemaCommand {
if (ifNotExists) {
return 0;
}
if (!orReplace || !old.getTableType().equals(Table.VIEW)) {
if (!orReplace || !Table.VIEW.equals(old.getTableType())) {
throw DbException.get(ErrorCode.VIEW_ALREADY_EXISTS_1, viewName);
}
view = (TableView) old;
......
......@@ -224,7 +224,7 @@ public class IndexCondition {
case Comparison.IN_LIST:
case Comparison.IN_QUERY:
if (indexConditions.size() > 1) {
if (!column.getTable().getTableType().equals(Table.TABLE)) {
if (!Table.TABLE.equals(column.getTable().getTableType())) {
// if combined with other conditions,
// IN(..) can only be used for regular tables
// test case:
......
......@@ -518,7 +518,7 @@ public class PageStore implements CacheWriter {
recordPageReads = true;
Session s = database.getSystemSession();
for (Table table : tables) {
if (!table.isTemporary() && table.getTableType().equals(Table.TABLE)) {
if (!table.isTemporary() && Table.TABLE.equals(table.getTableType())) {
Index scanIndex = table.getScanIndex(s);
Cursor cursor = scanIndex.find(s, null, null);
while (cursor.next()) {
......
......@@ -51,6 +51,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
public void test() throws Exception {
deleteDb("functions");
testFunctionTable();
testArrayParameters();
testDefaultConnection();
testFunctionInSchema();
......@@ -74,6 +75,28 @@ public class TestFunctions extends TestBase implements AggregateFunction {
IOUtils.deleteRecursive(TEMP_DIR, true);
}
private void testFunctionTable() throws SQLException {
Connection conn = getConnection("functions");
Statement stat = conn.createStatement();
stat.execute("create alias simple_function_table for \"" + TestFunctions.class.getName() + ".simpleFunctionTable\"");
stat.execute("select * from simple_function_table() where a>0 and b in ('x', 'y')");
conn.close();
}
/**
* This method is called via reflection from the database.
*
* @param conn the connection
* @return a result set
*/
public static ResultSet simpleFunctionTable(Connection conn) {
SimpleResultSet result = new SimpleResultSet();
result.addColumn("A", Types.INTEGER, 0, 0);
result.addColumn("B", Types.CHAR, 0, 0);
result.addRow(42, 'X');
return result;
}
private void testNvl2() throws SQLException {
Connection conn = getConnection("functions");
Statement stat = conn.createStatement();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论