提交 0afa97c3 authored 作者: mhewedy's avatar mhewedy

Fix Alter Table Drop Column In View when table name is wrapped by Double Quotes

上级 54d25b13
......@@ -296,7 +296,7 @@ public class AlterTableAlterColumn extends CommandWithColumns {
// (because the column to drop is referenced or so)
checkViews(table, newTable);
} catch (DbException e) {
execute("DROP TABLE " + newTable.getName(), true);
execute("DROP TABLE " + newTable.getSQL(), true);
throw e;
}
String tableName = table.getName();
......
......@@ -46,6 +46,7 @@ public class TestViewAlterTable extends TestDb {
testJoinAndAlias();
testSubSelect();
testForeignKey();
testAlterTableDropColumnInViewWithDoubleQuotes();
conn.close();
deleteDb(getTestName());
......@@ -197,4 +198,18 @@ public class TestViewAlterTable extends TestDb {
}
}
// original error: table "XX_COPY_xx_xx" not found
private void testAlterTableDropColumnInViewWithDoubleQuotes() throws SQLException{
// simple
stat.execute("create table \"test\"(id identity, name varchar) " +
"as select x, 'Hello'");
stat.execute("create view test_view as select * from \"test\"");
assertThrows(ErrorCode.COLUMN_IS_REFERENCED_1, stat).
execute("alter table \"test\" drop name");
ResultSet rs = stat.executeQuery("select * from test_view");
assertTrue(rs.next());
stat.execute("drop view test_view");
stat.execute("drop table \"test\"");
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论