summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/array.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2021-08-15 12:21:13 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2021-08-15 23:14:59 -0400
commitb987465332ab9fdbab9ad85435919a2967004b12 (patch)
tree3cd6a28103409c37a96cdf9b9cbe1feac19a723d /lib/sqlalchemy/dialects/postgresql/array.py
parent66144dbdc75dd67422e8b6def5b30694a25069e7 (diff)
downloadsqlalchemy-b987465332ab9fdbab9ad85435919a2967004b12.tar.gz
fix linter JOIN logic; fix PostgreSQL ARRAY op comparison
Adjusted the "from linter" warning feature to accommodate for a chain of joins more than one level deep where the ON clauses don't explicitly match up the targets, such as an expression such as "ON TRUE". This mode of use is intended to cancel the cartesian product warning simply by the fact that there's a JOIN from "a to b", which was not working for the case where the chain of joins had more than one element. this incurs a bit more compiler overhead that comes out in profiling but is not extensive. Added the "is_comparison" flag to the PostgreSQL "overlaps", "contained_by", "contains" operators, so that they work in relevant ORM contexts as well as in conjunction with the "from linter" feature. Fixes: #6886 Change-Id: I078dc3fe6d4f7871ffe4ebac3e71e62f3f213d12
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/array.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/array.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/array.py b/lib/sqlalchemy/dialects/postgresql/array.py
index d8e54ae0c..1b036ac32 100644
--- a/lib/sqlalchemy/dialects/postgresql/array.py
+++ b/lib/sqlalchemy/dialects/postgresql/array.py
@@ -153,11 +153,11 @@ class array(expression.ClauseList, expression.ColumnElement):
return self
-CONTAINS = operators.custom_op("@>", precedence=5)
+CONTAINS = operators.custom_op("@>", precedence=5, is_comparison=True)
-CONTAINED_BY = operators.custom_op("<@", precedence=5)
+CONTAINED_BY = operators.custom_op("<@", precedence=5, is_comparison=True)
-OVERLAP = operators.custom_op("&&", precedence=5)
+OVERLAP = operators.custom_op("&&", precedence=5, is_comparison=True)
class ARRAY(sqltypes.ARRAY):