]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- [bug] A tweak to column precedence which moves the
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 22 Sep 2012 20:48:49 +0000 (16:48 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 22 Sep 2012 20:48:49 +0000 (16:48 -0400)
    "concat" and "match" operators to be the same as
    that of "is", "like", and others; this helps with
    parenthesization rendering when used in conjunction
    with "IS". [ticket:2564]

CHANGES
lib/sqlalchemy/sql/operators.py
test/sql/test_operators.py

diff --git a/CHANGES b/CHANGES
index ee9f2da571fb89f4478438d46e87422660630a69..f3342f84e223c2cbeedcd853677ca702f4232345 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -816,6 +816,12 @@ are also present in 0.8.
     operators are present as methods like all
     the other operators.  [ticket:2544]
 
+  - [bug] A tweak to column precedence which moves the
+    "concat" and "match" operators to be the same as
+    that of "is", "like", and others; this helps with
+    parenthesization rendering when used in conjunction
+    with "IS". [ticket:2564]
+
 - engine
   - [bug] Fixed bug whereby
     a disconnect detect + dispose that occurs
index ad9fa46688ec90364887c59988226dc9a28ed331..2e2ff3af15c311556a475ef6da10793b7d25da2b 100644 (file)
@@ -670,31 +670,36 @@ _largest = symbol('_largest', canonical=100)
 _PRECEDENCE = {
     from_: 15,
     getitem: 15,
-    mul: 7,
-    truediv: 7,
+    mul: 8,
+    truediv: 8,
     # Py2K
-    div: 7,
+    div: 8,
     # end Py2K
-    mod: 7,
-    neg: 7,
-    add: 6,
-    sub: 6,
+    mod: 8,
+    neg: 8,
+    add: 7,
+    sub: 7,
+
     concat_op: 6,
     match_op: 6,
-    ilike_op: 5,
-    notilike_op: 5,
-    like_op: 5,
-    notlike_op: 5,
-    in_op: 5,
-    notin_op: 5,
-    is_: 5,
-    isnot: 5,
+
+    ilike_op: 6,
+    notilike_op: 6,
+    like_op: 6,
+    notlike_op: 6,
+    in_op: 6,
+    notin_op: 6,
+
+    is_: 6,
+    isnot: 6,
+
     eq: 5,
     ne: 5,
     gt: 5,
     lt: 5,
     ge: 5,
     le: 5,
+
     between_op: 5,
     distinct_op: 5,
     inv: 5,
index 951309d195ff3d302bd601796fa16f9042f102b4..b104f6097126aa5f35afe30de011b438c4e2675d 100644 (file)
@@ -345,6 +345,10 @@ class OperatorPrecedenceTest(fixtures.TestBase, testing.AssertsCompiledSQL):
             "SELECT op.field FROM op WHERE (op.field = op.field) "
                     "BETWEEN :param_1 AND :param_2")
 
+        self.assert_compile(table.select(
+                        table.c.field.match(table.c.field).is_(None)),
+            "SELECT op.field FROM op WHERE (op.field MATCH op.field) IS NULL")
+
 class OperatorAssociativityTest(fixtures.TestBase, testing.AssertsCompiledSQL):
     __dialect__ = 'default'