]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- merged fix of PG identifier length from 68 to 63 [ticket:571]
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 18 Jul 2007 19:06:10 +0000 (19:06 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 18 Jul 2007 19:06:10 +0000 (19:06 +0000)
- merged r2958, commutativity for _BinaryExpression.compare

CHANGES
lib/sqlalchemy/databases/postgres.py
lib/sqlalchemy/sql.py
test/orm/lazy_relations.py

diff --git a/CHANGES b/CHANGES
index e2d6010bf3abb70aae47ca71296c9a73bca1c9bd..235e77644a24bb82e475edd19a5cf1fa75299b9e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
     from SelectResults isn't present anymore, need to use join(). 
 - postgres
   - Added PGArray datatype for using postgres array datatypes
+  
+0.3.10
+- sql
+  - got connection-bound metadata to work with implicit execution
+  - foreign key specs can have any chararcter in their identifiers
+   [ticket:667]
+  - added commutativity-awareness to binary clause comparisons to
+    each other, improves ORM lazy load optimization [ticket:664]
+- orm
+  - cleanup to connection-bound sessions, SessionTransaction
+- postgres
+  - fixed max identifier length (63) [ticket:571]
+  
 0.3.9
 - general
     - better error message for NoSuchColumnError [ticket:607]
index 3c37ac0071f1072a41102f28f059593fc94d8f52..469614fbb3e618df3a986a9017461f8433985c8f 100644 (file)
@@ -223,7 +223,7 @@ class PGDialect(ansisql.ANSIDialect):
         return PGExecutionContext(self, *args, **kwargs)
 
     def max_identifier_length(self):
-        return 68
+        return 63
         
     def type_descriptor(self, typeobj):
         return sqltypes.adapt_type(typeobj, colspecs)
index e044729e0810754f48ee6b2bf31eddc41c666fc2..1129629ca63098c1124c9799a85fda40c4331f60 100644 (file)
@@ -2127,7 +2127,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):
index 5accb74713b6e882226fb8581912024d2cac8dce..e9d77e09c6df6f346f450dd79ce12f0f141b8280 100644 (file)
@@ -230,23 +230,29 @@ class LazyTest(QueryTest):
     def test_uses_get(self):
         """test that a simple many-to-one lazyload optimizes to use query.get()."""
 
-        mapper(Address, addresses, properties = dict(
-            user = relation(mapper(User, users), lazy=True)
-        ))
+        for pj in (
+            None,
+            users.c.id==addresses.c.user_id,
+            addresses.c.user_id==users.c.id
+        ):
+            mapper(Address, addresses, properties = dict(
+                user = relation(mapper(User, users), lazy=True, primaryjoin=pj)
+            ))
         
-        sess = create_session()
+            sess = create_session()
         
-        # load address
-        a1 = sess.query(Address).filter_by(email_address="ed@wood.com").one()
+            # load address
+            a1 = sess.query(Address).filter_by(email_address="ed@wood.com").one()
         
-        # load user that is attached to the address
-        u1 = sess.query(User).get(8)
+            # load user that is attached to the address
+            u1 = sess.query(User).get(8)
+        
+            def go():
+                # lazy load of a1.user should get it from the session
+                assert a1.user is u1
+            self.assert_sql_count(testbase.db, go, 0)
+            clear_mappers()
         
-        def go():
-            # lazy load of a1.user should get it from the session
-            assert a1.user is u1
-        self.assert_sql_count(testbase.db, go, 0)
-
     def test_many_to_one(self):
         mapper(Address, addresses, properties = dict(
             user = relation(mapper(User, users), lazy=True)