very small fix to _BinaryExpression.compare
Comparing two _BinaryExpressions have not considered that one of them could be reversed, i.e (Column, _BindParamClause) equals (_BindParamClause,Column) patch is simple.
I have found it looking at strange lazy load queries.
Comments (6)
-
repo owner -
repo owner not to mention that not all BinaryExpressions are commutative, awareness of this would need to be added.
-
Account Deleted Replying to zzzeek:
not to mention that not all BinaryExpressions are commutative, awareness of this would need to be added.
Heh! My fault. Of course, this patch should be used only for commutative operators, like '='.
-
Account Deleted I noticed that some simple lazy loads do not query database, if instance already in session, while others, very similar, still do.
The bug is that some lazy properties have use_get == False in LazyLoader.init because of uncorrect comparing of BinaryExpressions, where first BinaryExpression is
left: Column operator: '=' right: _BindParamClause
and second is
left:_BindParamClause operator: '=' right:Column
and Columns are the same.
It's seems evedent to me, that for commutative operators, comparing should be commutative too.
-
Account Deleted - attached _BinaryExpression.compare_v2.patch
Fix now works only for '=' operator
-
repo owner OK i was looking for a test case here since those are generally needed for all checkins, but i managed to create one myself. fix is in changeset:2958, changeset:2959
- Log in to comment
can you please describe something which you've seen fail without this patch ? some example code would be best.