From 11619ad8eeb137efd84bda67d34414c3c3e00080 Mon Sep 17 00:00:00 2001 From: Ants Aasma Date: Mon, 20 Oct 2008 20:41:09 +0000 Subject: Slightly changed behavior of IN operator for comparing to empty collections. Now results in inequality comparison against self. More portable, but breaks with stored procedures that aren't pure functions. --- lib/sqlalchemy/sql/expression.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/sql/expression.py') diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index b721e5884..cb2bcd6d6 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -1383,8 +1383,8 @@ class _CompareMixin(ColumnOperators): args.append(o) if len(args) == 0: - # Special case handling for empty IN's - return _Grouping(case([(self.__eq__(None), text('NULL'))], else_=text('0')).__eq__(text('1'))) + # Special case handling for empty IN's, behave like comparison against zero row selectable + return self != self return self.__compare(op, ClauseList(*args).self_group(against=op), negate=negate_op) -- cgit v1.2.1