bug fixed for sql schema resolve. for issue #2264

This commit is contained in:
wenshao
2018-02-04 15:44:51 +08:00
parent 1b1e1140c7
commit ce30557f8a
2 changed files with 17 additions and 6 deletions
@@ -2218,18 +2218,30 @@ class SchemaResolveVisitorFactory {
return;
}
String alias = from.getAlias();
SchemaObject table = repository.findTable((SQLExprTableSource) from);
if (table != null) {
SQLCreateTableStatement createTableStmt = (SQLCreateTableStatement) table.getStatement();
for (SQLTableElement e : createTableStmt.getTableElementList()) {
if (e instanceof SQLColumnDefinition) {
SQLColumnDefinition column = (SQLColumnDefinition) e;
SQLIdentifierExpr name = (SQLIdentifierExpr) column.getName().clone();
name.setResolvedColumn(column);
columns.add(new SQLSelectItem(name));
if (alias != null) {
SQLPropertyExpr name = new SQLPropertyExpr(alias, column.getName().getSimpleName());
name.setResolvedColumn(column);
columns.add(new SQLSelectItem(name));
} else {
SQLIdentifierExpr name = (SQLIdentifierExpr) column.getName().clone();
name.setResolvedColumn(column);
columns.add(new SQLSelectItem(name));
}
}
}
}
return;
}
if (from instanceof SQLJoinTableSource) {