mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for sql schema resolve. for issue #2264
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user