ResultSet.union() terms compatibility check is too restrictive

Bug #381692 reported by Celso Providelo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Storm
New
Undecided
Unassigned

Bug Description

In order to setup a UNION ResultSet successfully the find_spec in both terms has to be identical and sometimes that's too restrictive. For instance:

{{{
result1 = self.store.find((Foo, SQL('1')), Foo.id == 20)
result2 = self.store.find((Foo, SQL('2')), Foo.id == 30)
result = result1.union(result2)
}}}

For SQL and FuncExpr items, it seems that it would be safe enough to continue even if the they are not identical objects.

Revision history for this message
James Henstridge (jamesh) wrote :

If you want the attached branch to be reviewed, please submit a merge proposal.

Taking a quick look at the diff, I have a few comments:

 1. you probably only want to do this sort of check if is_expr1 is True.
 2. it would be better to check that both expressions have the same variable factory (i.e. getattr(info1, "variable_factory", Variable) is the same as getattr(info2, "variable_factory", Variable)).

Special casing SQL and FuncExpr seems wrong.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.