summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/sql/selectable.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py
index cc6d2bcc5..d4528f0c3 100644
--- a/lib/sqlalchemy/sql/selectable.py
+++ b/lib/sqlalchemy/sql/selectable.py
@@ -3227,6 +3227,14 @@ class Select(HasPrefixes, HasSuffixes, GenerativeSelect):
self._correlate = set(clone(f) for f in self._correlate).union(
self._correlate
)
+
+ # do something similar for _correlate_except - this is a more
+ # unusual case but same idea applies
+ if self._correlate_except:
+ self._correlate_except = set(
+ clone(f) for f in self._correlate_except
+ ).union(self._correlate_except)
+
# 4. clone other things. The difficulty here is that Column
# objects are not actually cloned, and refer to their original
# .table, resulting in the wrong "from" parent after a clone