[Sqlalchemy-tickets] Issue #3999: merge operator precedence for all like / is / eq / comparison to
Brought to you by:
zzzeek
From: Michael B. <iss...@bi...> - 2017-05-25 14:56:08
|
New issue 3999: merge operator precedence for all like / is / eq / comparison to 5 https://bitbucket.org/zzzeek/sqlalchemy/issues/3999/merge-operator-precedence-for-all-like-is Michael Bayer: e.g.: ``` #!diff diff --git a/lib/sqlalchemy/sql/operators.py b/lib/sqlalchemy/sql/operators.py index 58f32b3..ca5a90b 100644 --- a/lib/sqlalchemy/sql/operators.py +++ b/lib/sqlalchemy/sql/operators.py @@ -1094,15 +1094,15 @@ _PRECEDENCE = { 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, + 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, ``` rationale: MySQL, Oracle and now Postgresql all have relatively flat precedences for these operators: (mysql): https://docs.oracle.com/cd/E17952_01/mysql-5.5-en/operator-precedence.html (oracle): https://docs.oracle.com/cd/B19306_01/server.102/b14200/conditions001.htm#i1034834 pg 9.4, less flat: https://www.postgresql.org/docs/9.4/static/sql-syntax-lexical.html#SQL-PRECEDENCE-TABLE pg 9.5, now is more flat: https://www.postgresql.org/docs/9.5/static/sql-syntax-lexical.html#SQL-PRECEDENCE-TABLE making these all have the same precedence means we'll just have more parenthesis. |