summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/sql.py')
-rw-r--r--lib/sqlalchemy/sql.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py
index 4c720dfa2..fecb5350b 100644
--- a/lib/sqlalchemy/sql.py
+++ b/lib/sqlalchemy/sql.py
@@ -2210,7 +2210,13 @@ class _BinaryExpression(ColumnElement):
return (
isinstance(other, _BinaryExpression) and self.operator == other.operator and
- self.left.compare(other.left) and self.right.compare(other.right)
+ (
+ self.left.compare(other.left) and self.right.compare(other.right)
+ or (
+ self.operator in ['=', '!=', '+', '*'] and
+ self.left.compare(other.right) and self.right.compare(other.left)
+ )
+ )
)
def self_group(self, against=None):