summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/ranges.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2018-04-03 15:35:00 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2018-04-03 15:36:48 -0400
commite1ac5dc63cc13cfbabe0ec7fbb3521bfb1b7b750 (patch)
tree8c8e587ae18a43a680bdde1799a6d8c4fb92144a /lib/sqlalchemy/dialects/postgresql/ranges.py
parent9f986ce10c6755af3f347a56f9ea03e0e2c5943e (diff)
downloadsqlalchemy-e1ac5dc63cc13cfbabe0ec7fbb3521bfb1b7b750.tar.gz
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
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/ranges.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/ranges.py6
1 files changed, 5 insertions, 1 deletions
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,