From b987465332ab9fdbab9ad85435919a2967004b12 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 15 Aug 2021 12:21:13 -0400 Subject: 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 --- lib/sqlalchemy/dialects/postgresql/array.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/sqlalchemy/dialects/postgresql/array.py') 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): -- cgit v1.2.1