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

Merge pull request #1065 from katzyn/ddl

Update schema rights on schema rename
......@@ -21,6 +21,18 @@ Change Log
<h2>Next Version (unreleased)</h2>
<ul>
<li>Issue #456: H2 table privileges referring to old schema after schema rename
</li>
<li>Yet another fix to Page memory accounting
</li>
<li>Replace MVStore.ASSERT variable with assertions
</li>
<li>Issue #1063: Leftover comments about enhanced for loops
</li>
<li>PR #1059: Assorted minor changes
</li>
<li>PR #1058: Txcommit atomic
</li>
<li>Issue #1038: ora_hash function implementation off by one
</li>
<li>PR #1054: Introduce overflow bit in tx state
......
......@@ -127,6 +127,18 @@ public class Schema extends DbObjectBase {
&& triggers.isEmpty() && constraints.isEmpty() && constants.isEmpty() && functions.isEmpty();
}
@Override
public ArrayList<DbObject> getChildren() {
ArrayList<DbObject> children = New.arrayList();
ArrayList<Right> rights = database.getAllRights();
for (Right right : rights) {
if (right.getGrantedObject() == this) {
children.add(right);
}
}
return children;
}
@Override
public void removeChildrenAndResources(Session session) {
while (triggers != null && triggers.size() > 0) {
......
......@@ -48,6 +48,8 @@ public class TestRights extends TestBase {
testSchemaRenameUser();
testAccessRights();
testSchemaAdminRole();
testTableRename();
testSchemaRename();
testSchemaDrop();
deleteDb("rights");
}
......@@ -492,6 +494,43 @@ public class TestRights extends TestBase {
conn.close();
}
private void testTableRename() throws SQLException {
if (config.memory) {
return;
}
deleteDb("rights");
Connection conn = getConnection("rights");
stat = conn.createStatement();
stat.execute("create user test password '' admin");
stat.execute("create schema b");
stat.execute("create table b.t1(id int)");
stat.execute("grant select on b.t1 to test");
stat.execute("alter table b.t1 rename to b.t2");
conn.close();
conn = getConnection("rights");
stat = conn.createStatement();
stat.execute("drop user test");
conn.close();
}
private void testSchemaRename() throws SQLException {
if (config.memory) {
return;
}
deleteDb("rights");
Connection conn = getConnection("rights");
stat = conn.createStatement();
stat.execute("create user test password '' admin");
stat.execute("create schema b");
stat.execute("grant select on schema b to test");
stat.execute("alter schema b rename to c");
conn.close();
conn = getConnection("rights");
stat = conn.createStatement();
stat.execute("drop user test");
conn.close();
}
private void testSchemaDrop() throws SQLException {
if (config.memory) {
return;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论