Found this in 3.5.0 and reproduced in 4.0.0. Looking at the Tags table, it appears to use a Nest Set (lft,rgt fields) for managing tag hierarchy in addition to the pid field. When moving a tag within the hierarchy, the lft and rgt fields are not updated. Given this initial tree: +----+------+----------------------------+------+---------+-----+-----+ | id | pid | name | icon | iconkde | lft | rgt | +----+------+----------------------------+------+---------+-----+-----+ | 8 | 0 | Parent | 0 | NULL | 4 | 15 | | 10 | 8 | Child1 | 0 | NULL | 9 | 14 | | 11 | 8 | Child2 | 0 | NULL | 5 | 8 | | 12 | 10 | SubChild1A | 0 | NULL | 12 | 13 | | 13 | 10 | SubChild1B | 0 | NULL | 10 | 11 | | 14 | 11 | SubChild2A | 0 | NULL | 6 | 7 | +----+------+----------------------------+------+---------+-----+-----+ Moving SubChild1A under Child2 results in this: +----+------+----------------------------+------+---------+-----+-----+ | id | pid | name | icon | iconkde | lft | rgt | +----+------+----------------------------+------+---------+-----+-----+ | 8 | 0 | Parent | 0 | NULL | 4 | 15 | | 10 | 8 | Child1 | 0 | NULL | 9 | 14 | | 11 | 8 | Child2 | 0 | NULL | 5 | 8 | | 12 | 11 | SubChild1A | 0 | NULL | 12 | 13 | | 13 | 10 | SubChild1B | 0 | NULL | 10 | 11 | | 14 | 11 | SubChild2A | 0 | NULL | 6 | 7 | +----+------+----------------------------+------+---------+-----+-----+ The pid is properly updated, but the lft and rgt columns still indicate is a child of Child1. I suspect this also explains bug 273852.
This file still valid using last digiKam 5.0.0 ? Gilles Caulier
Martin, How exactly did you move the tag? Did you first remove and then assigned the tag again?
(In reply to swatilodha27 from comment #2) > Martin, > > How exactly did you move the tag? Did you first remove and then assigned the > tag again? It was drag and drop within the tags hierarchy. Martin
(In reply to caulier.gilles from comment #1) > This file still valid using last digiKam 5.0.0 ? > > Gilles Caulier I'll have to get back to you on that. Martin
I can reproduce the problem with 5.0.0 version.
Valid for both Internal and Remote.
Created attachment 100043 [details] Please test this.
Created attachment 100063 [details] Please see this one too. Which of these approaches would be fine?
Created attachment 100102 [details] Please test with this patch.
Swaty, Just to be clear, what's the clear procedure to check if patch work as expected ? Which mysql commands do you use to check tags hierarchy ? Gilles
Steps to reproduce: 1) Add a new image and assign it 2-3 tags. 2) Check in Tags table, and observe the pid, lft, rgt values in it for the Tags assigned. 3) Back in DK, under "Tags" view (in left sidebar), drap and drop tags such that they're in hierarchy. (one tag becomes child of another) 4) Check back the Tags table. (without patch) --->parent tag id (pid) is updated, but lft and rgt values are still the same. (with patch) ---> all three values updated according to hierarchy.
I tested the Mysql Database into Tags table with Tora frontend. I confirm that without the patch lft/rgt id are not updated in database when i move a tags from hierarchy in another place. I confirm also that your patch do the job as expected. Gilles Caulier
Git commit b8df6225e3cafdd720120f4bad4150fd78525e02 by Swati Lodha. Committed on 16/07/2016 at 20:33. Pushed by swatil into branch 'master'. Set fields in Tag table now updates BUG:338050 CCBUG:338050 FIXED-IN:5.1.0 M +2 -0 app/dragdrop/tagdragdrop.cpp M +12 -0 libs/database/coredb/coredb.cpp M +8 -0 libs/database/coredb/coredb.h M +2 -0 libs/database/coredb/coredbchangesets.h http://commits.kde.org/digikam/b8df6225e3cafdd720120f4bad4150fd78525e02