From f8a3f14e4f862a4bf0be591699f1f72815c72514 Mon Sep 17 00:00:00 2001 From: Michael Birtwell Date: Thu, 25 May 2017 11:11:21 -0400 Subject: Flatten operator precedence for comparison operators The operator precedence for all comparison operators such as LIKE, IS, IN, MATCH, equals, greater than, less than, etc. has all been merged into one level, so that expressions which make use of these against each other will produce parentheses between them. This suits the stated operator precedence of databases like Oracle, MySQL and others which place all of these operators as equal precedence, as well as Postgresql as of 9.5 which has also flattened its operator precendence. Co-authored-by: Mike Bayer Fixes: #3999 Change-Id: I3f3d5124a64af0d376361cdf15a97e2e703be56f Pull-request: https://github.com/zzzeek/sqlalchemy/pull/367 --- lib/sqlalchemy/sql/operators.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/sqlalchemy/sql/operators.py b/lib/sqlalchemy/sql/operators.py index 58f32b3e6..f8731385b 100644 --- a/lib/sqlalchemy/sql/operators.py +++ b/lib/sqlalchemy/sql/operators.py @@ -1091,18 +1091,19 @@ _PRECEDENCE = { sub: 7, concat_op: 6, - match_op: 6, - notmatch_op: 6, - - ilike_op: 6, - notilike_op: 6, - like_op: 6, - notlike_op: 6, - in_op: 6, - notin_op: 6, - - is_: 6, - isnot: 6, + + match_op: 5, + notmatch_op: 5, + + ilike_op: 5, + notilike_op: 5, + like_op: 5, + notlike_op: 5, + in_op: 5, + notin_op: 5, + + is_: 5, + isnot: 5, eq: 5, ne: 5, -- cgit v1.2.1