summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/ranges.py
diff options
context:
space:
mode:
authorJim Bosch <jbosch@astro.princeton.edu>2020-07-26 16:50:14 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2020-07-26 16:57:13 -0400
commit07e57a0330fb7b1bbe0c59f442111a34e4b7c960 (patch)
tree9310c47b7ceb59fce44b6f4b29d2d6571fcc7a4b /lib/sqlalchemy/dialects/postgresql/ranges.py
parent9e1ee412b8650761af6df993e119906682604728 (diff)
downloadsqlalchemy-07e57a0330fb7b1bbe0c59f442111a34e4b7c960.tar.gz
Ensure is_comparison passed for PG RANGE op() methods
Fixed issue where the return type for the various RANGE comparison operators would itself be the same RANGE type rather than BOOLEAN, which would cause an undesirable result in the case that a :class:`.TypeDecorator` that defined result-processing behavior were in use. Pull request courtesy Jim Bosch. Fixes: #5476 Closes: #5477 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5477 Pull-request-sha: 925b117e0c91cdd67d9ddbd9d65f5ca3e88af91f Change-Id: I52ab4d4362d379c8253990f9d328a40990a64520
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/ranges.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/ranges.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/ranges.py b/lib/sqlalchemy/dialects/postgresql/ranges.py
index d4f75b494..a31d958ed 100644
--- a/lib/sqlalchemy/dialects/postgresql/ranges.py
+++ b/lib/sqlalchemy/dialects/postgresql/ranges.py
@@ -36,32 +36,32 @@ class RangeOperators(object):
other
)
else:
- return self.expr.op("<>")(other)
+ return self.expr.op("<>", is_comparison=True)(other)
def contains(self, other, **kw):
"""Boolean expression. Returns true if the right hand operand,
which can be an element or a range, is contained within the
column.
"""
- return self.expr.op("@>")(other)
+ return self.expr.op("@>", is_comparison=True)(other)
def contained_by(self, other):
"""Boolean expression. Returns true if the column is contained
within the right hand operand.
"""
- return self.expr.op("<@")(other)
+ return self.expr.op("<@", is_comparison=True)(other)
def overlaps(self, other):
"""Boolean expression. Returns true if the column overlaps
(has points in common with) the right hand operand.
"""
- return self.expr.op("&&")(other)
+ return self.expr.op("&&", is_comparison=True)(other)
def strictly_left_of(self, other):
"""Boolean expression. Returns true if the column is strictly
left of the right hand operand.
"""
- return self.expr.op("<<")(other)
+ return self.expr.op("<<", is_comparison=True)(other)
__lshift__ = strictly_left_of
@@ -69,7 +69,7 @@ class RangeOperators(object):
"""Boolean expression. Returns true if the column is strictly
right of the right hand operand.
"""
- return self.expr.op(">>")(other)
+ return self.expr.op(">>", is_comparison=True)(other)
__rshift__ = strictly_right_of
@@ -77,19 +77,19 @@ class RangeOperators(object):
"""Boolean expression. Returns true if the range in the column
does not extend right of the range in the operand.
"""
- return self.expr.op("&<")(other)
+ return self.expr.op("&<", is_comparison=True)(other)
def not_extend_left_of(self, other):
"""Boolean expression. Returns true if the range in the column
does not extend left of the range in the operand.
"""
- return self.expr.op("&>")(other)
+ return self.expr.op("&>", is_comparison=True)(other)
def adjacent_to(self, other):
"""Boolean expression. Returns true if the range in the column
is adjacent to the range in the operand.
"""
- return self.expr.op("-|-")(other)
+ return self.expr.op("-|-", is_comparison=True)(other)
def __add__(self, other):
"""Range expression. Returns the union of the two ranges.