提交 29cba7f9 authored 作者: Thomas Mueller's avatar Thomas Mueller

When altering a table with triggers, new triggers are created and initialized…

When altering a table with triggers, new triggers are created and initialized with a table name that ends with tableName_COPY_x_y.
上级 94280278
...@@ -174,7 +174,8 @@ public class AlterTableAlterColumn extends SchemaCommand { ...@@ -174,7 +174,8 @@ public class AlterTableAlterColumn extends SchemaCommand {
throw DbException.getUnsupportedException("TEMP TABLE"); throw DbException.getUnsupportedException("TEMP TABLE");
} }
Database db = session.getDatabase(); Database db = session.getDatabase();
String tempName = db.getTempTableName(session); String baseName = table.getName();
String tempName = db.getTempTableName(baseName, session);
Column[] columns = table.getColumns(); Column[] columns = table.getColumns();
ArrayList<Column> newColumns = New.arrayList(); ArrayList<Column> newColumns = New.arrayList();
Table newTable = cloneTableStructure(columns, db, tempName, newColumns); Table newTable = cloneTableStructure(columns, db, tempName, newColumns);
...@@ -358,7 +359,7 @@ public class AlterTableAlterColumn extends SchemaCommand { ...@@ -358,7 +359,7 @@ public class AlterTableAlterColumn extends SchemaCommand {
String newTableName = newTable.getName(); String newTableName = newTable.getName();
Database db = sourceTable.getDatabase(); Database db = sourceTable.getDatabase();
// save the real table under a temporary name // save the real table under a temporary name
db.renameSchemaObject(session, sourceTable, db.getTempTableName(session)); db.renameSchemaObject(session, sourceTable, db.getTempTableName(sourceTableName, session));
try { try {
// have our new table impersonate the target table // have our new table impersonate the target table
db.renameSchemaObject(session, newTable, sourceTableName); db.renameSchemaObject(session, newTable, sourceTableName);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论