useless load during flush for joined-table pending objects

Issue #1992 resolved
Mike Bayer repo owner created an issue

fairly incredible this has not been noticed. Its possible there are side effects to this, such as when loading state in the just-flushed object. initial fix:

diff -r 582b12152eb80bad865326dcda2f0a4fc51042d6 lib/sqlalchemy/orm/mapper.py
--- a/lib/sqlalchemy/orm/mapper.py      Tue Nov 30 13:55:17 2010 -0500
+++ b/lib/sqlalchemy/orm/mapper.py      Fri Dec 03 14:06:51 2010 -0500
@@ -2442,7 +2442,7 @@
     has_key = state.has_identity

     result = False
-    if mapper.inherits and not mapper.concrete:
+    if has_key and mapper.inherits and not mapper.concrete:
         statement = mapper._optimized_get_statement(state, attribute_names)
         if statement is not None:
             result = session.query(mapper).from_statement(statement).\

Comments (4)

  1. Mike Bayer reporter
    • changed milestone to 0.7.0

    hooray, its an 0.7 issue. its got to do with defaults and the stacking of columns change.

  2. Log in to comment