From e1ac5dc63cc13cfbabe0ec7fbb3521bfb1b7b750 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 3 Apr 2018 15:35:00 -0400 Subject: Use base __ne__ implementation for range types w/ None Fixed bug where the special "not equals" operator for the Postgresql "range" datatypes such as DATERANGE would fail to render "IS NOT NULL" when compared to the Python ``None`` value. Also break up range tests into backend round trip and straight compilation suites. Change-Id: Ibaee132b1ea7dac8b799495a27f98f82a7d9c028 Fixes: #4229 --- lib/sqlalchemy/dialects/postgresql/ranges.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/dialects/postgresql/ranges.py') diff --git a/lib/sqlalchemy/dialects/postgresql/ranges.py b/lib/sqlalchemy/dialects/postgresql/ranges.py index 38bfb37d4..eb2d86bbd 100644 --- a/lib/sqlalchemy/dialects/postgresql/ranges.py +++ b/lib/sqlalchemy/dialects/postgresql/ranges.py @@ -33,7 +33,11 @@ class RangeOperators(object): def __ne__(self, other): "Boolean expression. Returns true if two ranges are not equal" - return self.expr.op('<>')(other) + if other is None: + return super( + RangeOperators.comparator_factory, self).__ne__(other) + else: + return self.expr.op('<>')(other) def contains(self, other, **kw): """Boolean expression. Returns true if the right hand operand, -- cgit v1.2.1