diff options
Diffstat (limited to '')
-rw-r--r-- | sqlglot/optimizer/optimize_joins.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sqlglot/optimizer/optimize_joins.py b/sqlglot/optimizer/optimize_joins.py index d51276f..7b3b2b1 100644 --- a/sqlglot/optimizer/optimize_joins.py +++ b/sqlglot/optimizer/optimize_joins.py @@ -59,7 +59,7 @@ def reorder_joins(expression): dag = {name: other_table_names(join) for name, join in joins.items()} parent.set( "joins", - [joins[name] for name in tsort(dag) if name != from_.alias_or_name], + [joins[name] for name in tsort(dag) if name != from_.alias_or_name and name in joins], ) return expression |