summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2021-05-05 22:06:19 +0200
committerFederico Caselli <cfederico87@gmail.com>2021-05-05 22:06:19 +0200
commitadb3a302ef1f25ae41b2a83ce857e3ed2613c84d (patch)
treeb5c8fdb462b6e78c7e75e5007be76d035aaf8b98 /lib/sqlalchemy/sql/compiler.py
parent03d922d4ee35d6a02ffe4f06dc2fd2670c4f3f50 (diff)
downloadsqlalchemy-adb3a302ef1f25ae41b2a83ce857e3ed2613c84d.tar.gz
Add a comment in the compiler on why the NOT IN operator
is rendered using brackets. Change-Id: I39c2e6a03e8aad7ff27bc6000da5bc9f1de14dc2
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 437a11a60..dedd75f5c 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -1908,6 +1908,9 @@ class SQLCompiler(Compiled):
return self._render_in_expr_w_bindparam(binary, operator, **kw)
def visit_not_in_op_binary(self, binary, operator, **kw):
+ # The brackets are required in the NOT IN operation because the empty
+ # case is handled using the form "(col NOT IN (null) OR 1 = 1)".
+ # The presence of the OR makes the brackets required.
return "(%s)" % self._render_in_expr_w_bindparam(
binary, operator, **kw
)