summaryrefslogtreecommitdiff
path: root/test/sql/test_compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-01-03 17:28:52 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2022-01-03 17:39:51 -0500
commit6b646139bbff267d4f84943c982808fc33ea9cb9 (patch)
tree31aa3a15ca05a8ad662683492bb3ab3a6229d49e /test/sql/test_compiler.py
parentdd8e33d84f9d0449c14e51a4e3ffdefdd470f961 (diff)
downloadsqlalchemy-6b646139bbff267d4f84943c982808fc33ea9cb9.tar.gz
ensure correlate_except is checked for empty tuple
Fixed issue where :meth:`_sql.Select.correlate_except` method, when passed either the ``None`` value or no arguments, would not correlate any elements when used in an ORM context (that is, passing ORM entities as FROM clauses), rather than causing all FROM elements to be considered as "correlated" in the same way which occurs when using Core-only constructs. Fixes: #7514 Change-Id: Ic4a5252c8f3c1140aba6c308264948f3a91f33f5 (cherry picked from commit 709239f4a61e88c2051dce87eb4058efd653697e)
Diffstat (limited to 'test/sql/test_compiler.py')
-rw-r--r--test/sql/test_compiler.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py
index eeb102162..50fd582b7 100644
--- a/test/sql/test_compiler.py
+++ b/test/sql/test_compiler.py
@@ -5902,6 +5902,14 @@ class CorrelateTest(fixtures.TestBase, AssertsCompiledSQL):
)
)
+ def test_correlate_except_empty(self):
+ t1, t2, s1 = self._fixture()
+ self._assert_where_all_correlated(
+ select(t1, t2).where(
+ t2.c.a == s1.correlate_except().scalar_subquery()
+ )
+ )
+
def test_correlate_except_having(self):
t1, t2, s1 = self._fixture()
self._assert_having_correlated(