summaryrefslogtreecommitdiffstats
path: root/sqlglot/optimizer/annotate_types.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-20 08:50:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-20 08:50:35 +0000
commit6a22086850fc960715b618e82f4c2e43a4529146 (patch)
tree2005800d79fbd3b3a72ed36d10857fadd61306b7 /sqlglot/optimizer/annotate_types.py
parentReleasing debian version 11.1.3-1. (diff)
downloadsqlglot-6a22086850fc960715b618e82f4c2e43a4529146.tar.xz
sqlglot-6a22086850fc960715b618e82f4c2e43a4529146.zip
Merging upstream version 11.2.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/optimizer/annotate_types.py')
-rw-r--r--sqlglot/optimizer/annotate_types.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/sqlglot/optimizer/annotate_types.py b/sqlglot/optimizer/annotate_types.py
index be65ab9..ca2131c 100644
--- a/sqlglot/optimizer/annotate_types.py
+++ b/sqlglot/optimizer/annotate_types.py
@@ -286,7 +286,7 @@ class TypeAnnotator:
source = scope.sources.get(col.table)
if isinstance(source, exp.Table):
col.type = self.schema.get_column_type(source, col)
- elif source and col.table in selects:
+ elif source and col.table in selects and col.name in selects[col.table]:
col.type = selects[col.table][col.name].type
# Then (possibly) annotate the remaining expressions in the scope
self._maybe_annotate(scope.expression)