Defect #12846

sub-issues being rendered under wrong parent issue

Added by Paul Wilson over 7 years ago. Updated over 7 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Issues
Target version:-
Resolution: Affected version:2.0.4

Description

I have a group of issues that seem to be rendering as associated with the wrong parent issue.

This query on the database returns zero items:

select count(0) from issues where root_id=19649 or parent_id= 19649 ;

Rendering the URL: http://my_redmine/issues/19649 shows this list of sub-tasks associated with this issue.

19547, 19121, 19099, 18966, 18956, 18825, 18572, 17887, 17799, 17795, 17601, 18532, 20011

Yet, if I plug the ids of those listed sub-tasks into a database query like this:

select id, parent_id, root_id from issues where id in (19547, 19121, 19099, 18966, 18956, 18825, 18572, 17887, 17799, 17795, 17601, 18532, 20011);

I get this result:

 + -------+-------------+---------+
  |    id    | parent_id | root_id |
 + -------+-------------+---------+
  17601 |    19925    | 19925
  17795 |    19925    | 19925
  17799 |    19925    | 19925
  17887 |    19925    | 19925
  18532 |    19925    | 19925
  18572 |    19925    | 19925
  18825 |    19925    | 19925
  18956 |    19925    | 19925
  18966 |    19925    | 19925
  19099 |    19925    | 19925
  19121 |    19925    | 19925
  19547 |    19925    | 19925
  20011 |    19925    | 19925
  +-------+-----------+---------+
  13 rows in set (0.00 sec)

19649 is also a sub-task of 19925 but 19649 is not a parent for any subtask. It would seem that rendering 19649 should show only that issue without any sub-tasks.

I am running tagged version 2.0.4. Is this the expected behavior or perhaps a bug?


Related issues

Related to Redmine - Defect #11319: Parent/child not displayed right New
Related to Redmine - Defect #6320: Subtasks do not appear under parent task in Issues view New 2010-09-07

History

#1 Updated by Jan Niggemann (redmine.org team member) over 7 years ago

We're talking about nested sets here, can you please include lft and rgt in your query?
If you ORDER BY lft you already have the basic hierarchy...
SELECT id, parent_id, root_id, lft, rgt from issues WHERE root_id=53 ORDER by lft

#2 Updated by Paul Wilson over 7 years ago

Is this what you are requesting? Here is the same query with lft and rgt included, ordered by lft:

select id, parent_id, root_id, lft, rgt from issues where id in (19547, 19121, 19099, 18966, 18956, 18825, 18572, 17887, 17799, 17795, 17601, 18532, 20011) order by lft;

select id, parent_id, root_id, lft, rgt from issues where id in (19547, 19121, 19099, 18966, 18956, 18825, 18572, 17887, 17799, 17795, 17601, 18532, 20011) order by lft;
 
+---------+------------+---------+-------+------+ 
       id    | parent_id | root_id |   lft    |   rgt 
+---------+------------+---------+-------+------+ 
  19547  |   19925   | 19925 |   81   |   82  |
  19121  |   19925   | 19925 |   83   |   84  |
  19099  |   19925   | 19925 |   85   |   86  |
  18966  |   19925   | 19925 |   87   |   88  |
  18956  |   19925   | 19925 |   89   |   90  |
  18825  |   19925   | 19925 |   91   |   92  |
  18572  |   19925   | 19925 |   93   |   94  |
  17887  |   19925   | 19925 |   95   |   96  |
  17799  |   19925   | 19925 |   97   |   98  |
  17795  |   19925   | 19925 |   99   | 100  |
  17601  |   19925   | 19925 | 101   | 102  |
  18532  |   19925   | 19925 | 103   | 104  |
  20011  |   19925   | 19925 | 105   | 106  |
+---------+------------+---------+-------+------+ 
13 rows in set (0.01 sec)

#3 Updated by Daniel Felix over 7 years ago

Maybe this relates with #11319.

#4 Updated by Paul Wilson over 7 years ago

I agree, it could be, and likely is, related to #11319.

I fixed this one occurance by manually updating my issue 19649 and setting the value of rgt to the value of lft +1. Now both of my issues 19649 and 19925 render correctly.

I can't document for sure how this happened but I suspect that at one time:

19649 had several sub-tasks associated with it
those sub-tasks were moved to a different parent task
19649 was also added as a sub-task to this new parent task

issue 19649 didn't get updated to reflect the loss of its sub-tasks

#5 Updated by Toshi MARUYAMA over 5 years ago

  • Related to Defect #6320: Subtasks do not appear under parent task in Issues view added

Also available in: Atom PDF