summaryrefslogtreecommitdiffstats
path: root/sqlglot/optimizer/isolate_table_selects.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-07-14 05:43:02 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-07-14 05:43:02 +0000
commitc8d4d4ead5df1c84966431eec8b88e974414dafc (patch)
tree847e292ab98fe79a3a78cd6797b564b73f4d2681 /sqlglot/optimizer/isolate_table_selects.py
parentReleasing debian version 17.3.0-1. (diff)
downloadsqlglot-c8d4d4ead5df1c84966431eec8b88e974414dafc.tar.xz
sqlglot-c8d4d4ead5df1c84966431eec8b88e974414dafc.zip
Merging upstream version 17.4.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/optimizer/isolate_table_selects.py')
-rw-r--r--sqlglot/optimizer/isolate_table_selects.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/sqlglot/optimizer/isolate_table_selects.py b/sqlglot/optimizer/isolate_table_selects.py
index 79e3ed5..a6524b8 100644
--- a/sqlglot/optimizer/isolate_table_selects.py
+++ b/sqlglot/optimizer/isolate_table_selects.py
@@ -12,7 +12,12 @@ def isolate_table_selects(expression, schema=None):
continue
for _, source in scope.selected_sources.values():
- if not isinstance(source, exp.Table) or not schema.column_names(source):
+ if (
+ not isinstance(source, exp.Table)
+ or not schema.column_names(source)
+ or isinstance(source.parent, exp.Subquery)
+ or isinstance(source.parent.parent, exp.Table)
+ ):
continue
if not source.alias: