Merge lp://qastaging/~therp-nl/openupgrade-server/7.0-lp1131653_check_recursion_fix_false_positives into lp://qastaging/openupgrade-server
Proposed by
Stefan Rijnhart (Opener)
Status: | Work in progress |
---|---|
Proposed branch: | lp://qastaging/~therp-nl/openupgrade-server/7.0-lp1131653_check_recursion_fix_false_positives |
Merge into: | lp://qastaging/openupgrade-server |
Diff against target: |
47 lines (+17/-8) 1 file modified
openerp/osv/orm.py (+17/-8) |
To merge this branch: | bzr merge lp://qastaging/~therp-nl/openupgrade-server/7.0-lp1131653_check_recursion_fix_false_positives |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mohammad Alhashash (community) | Needs Fixing | ||
Holger Brunn (Therp) | Needs Fixing | ||
Review via email: mp+150053@code.qastaging.launchpad.net |
Description of the change
The bug that this branch aims to fix was discovered when testing the migration scripts for the base module.
To post a comment you must log in.
Unmerged revisions
- 4605. By Stefan Rijnhart (Opener)
-
[FIX] _check_recursion gives false positive if ids include a parent/child pair
You can do that a lot simpler and save fetches by letting the server build a common table expression that checks for cycles:
create table rec_test (id int, parent_id int) -- that's just for the example
with recursive check_cycle(id, parent_id, is_cycle) as (select id, parent_id, False from rec_test union all select check_cycle.id, rec_test.parent_id, check_cycle.id = rec_test.parent_id from check_cycle join rec_test on check_cycle. parent_ id=rec_ test.id and rec_test.parent_id is not null and not is_cycle) select * from check_cycle -- that's the real thing
Filter for the ids to check in the non-recursive part, then select rows with is_cycle=True and you're done with just this statement.