Skip to content

Commit 982bd16

Browse files
committed
Fix(optimizer): merge_subqueries bug where Identifier was set as a table alias
1 parent 1253922 commit 982bd16

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

sqlglot/optimizer/merge_subqueries.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def _rename_inner_sources(outer_scope: Scope, inner_scope: Scope, alias: str) ->
248248
new_alias = exp.to_identifier(new_name)
249249

250250
if isinstance(source, exp.Table) and source.alias:
251-
source.set("alias", new_alias)
251+
source.set("alias", exp.TableAlias(this=new_alias))
252252
elif isinstance(source, exp.Table):
253253
source.replace(exp.alias_(source, new_alias))
254254
elif isinstance(source.parent, exp.Subquery):

0 commit comments

Comments
 (0)