提交 2a9dc1ec authored 作者: Noel Grandin's avatar Noel Grandin

use regular session for creating view

上级 39fdef7a
...@@ -99,11 +99,6 @@ public class CreateView extends SchemaCommand { ...@@ -99,11 +99,6 @@ public class CreateView extends SchemaCommand {
} }
querySQL = select.getPlanSQL(); querySQL = select.getPlanSQL();
} }
// The view creates a Prepared command object, which belongs to a
// session, so we pass the system session down.
Session sysSession = db.getSystemSession();
synchronized (sysSession) {
try {
Column[] columnTemplates = null; Column[] columnTemplates = null;
if (columnNames != null) { if (columnNames != null) {
columnTemplates = new Column[columnNames.length]; columnTemplates = new Column[columnNames.length];
...@@ -112,19 +107,11 @@ public class CreateView extends SchemaCommand { ...@@ -112,19 +107,11 @@ public class CreateView extends SchemaCommand {
} }
} }
if (view == null) { if (view == null) {
Schema schema = session.getDatabase().getSchema( view = new TableView(getSchema(), id, viewName, querySQL, null, columnTemplates, session, false, false);
session.getCurrentSchemaName());
sysSession.setCurrentSchema(schema);
view = new TableView(getSchema(), id, viewName, querySQL, null,
columnTemplates, sysSession, false, false);
} else { } else {
view.replace(querySQL, columnTemplates, sysSession, false, force, false); view.replace(querySQL, columnTemplates, session, false, force, false);
view.setModified(); view.setModified();
} }
} finally {
sysSession.setCurrentSchema(db.getSchema(Constants.SCHEMA_MAIN));
}
}
if (comment != null) { if (comment != null) {
view.setComment(comment); view.setComment(comment);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论