Bug 283323 - MYSQL : a new label "_Digikam_root_tag_" is created every time [patch]
Summary: MYSQL : a new label "_Digikam_root_tag_" is created every time [patch]
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Database-Mysql (show other bugs)
Version: 5.0.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-04 15:47 UTC by Leo
Modified: 2017-01-13 09:07 UTC (History)
17 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.1.0


Attachments
what happends (12.03 KB, image/jpeg)
2011-10-04 15:47 UTC, Leo
Details
Console output of mysql-statements from comment #7 (2.85 KB, application/octet-stream)
2011-10-30 11:33 UTC, Michael Holtermann
Details
To remove duplicates from Tags table (1.60 KB, patch)
2016-07-08 09:29 UTC, swatilodha27
Details
Removes _Digikam_root_tag_ from GUI (686 bytes, patch)
2016-07-08 17:06 UTC, swatilodha27
Details
Combined patch (2.27 KB, patch)
2016-07-08 19:07 UTC, swatilodha27
Details
Please test this with latest git/master and see if this fix this issue. (3.58 KB, patch)
2016-07-12 21:28 UTC, swatilodha27
Details
Please test this with latest git/master and see if this fix this issue. (2.24 KB, patch)
2016-07-12 21:30 UTC, swatilodha27
Details
Updated patch (3.34 KB, patch)
2016-07-15 21:34 UTC, swatilodha27
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Leo 2011-10-04 15:47:18 UTC
Created attachment 64205 [details]
what happends

Version:           2.1.1 (using KDE 4.7.1) 
OS:                Linux

Every time I start to tag some new face a new label "_Digikam_root_tag_" is created.


Reproducible: Always

Steps to Reproduce:
just start to tac some face. Should be in the tag "Persons" or the localized version.
If I rename it, a new "_Digikam_root_tag_" is created and the new label with the name is set in it


Expected Results:  
the name of the tagged person should be in "persons" root label
Comment 1 Marcel Wiesweg 2011-10-04 19:35:46 UTC
Francesco, I believe this is a MySQL specific tag?
Comment 2 Francesco Riosa 2011-10-04 20:07:39 UTC
(In reply to comment #0)
Leo if you're running on mysql database could you provide the output of the following query?

SELECT * FROM Tags ORDER BY id LIMIT 10;



(In reply to comment #1)
> Francesco, I believe this is a MySQL specific tag?

yes it is:
file: data/database/dbconfig.xml.cmake
Revision 24ee26d9

the tree algorithm used by the mysql schema need one and only one root, thus I'm inserting/replacing the tag with id = 0 in the tags table.

it should be executed _only_ by the "CreateTriggers" DBACtion.

SELECT
  @minLeft := IF(ISNULL(MIN(lft)), 1, MIN(lft)-1),
  @maxRight := IF(ISNULL(MAX(rgt)), 2, MAX(rgt)+1)
FROM Tags
WHERE id >= 0 AND pid>=0;

SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO';

REPLACE INTO Tags
  (id, pid, name, icon, iconkde, lft, rgt)
VALUES
(0, -1, '_Digikam_root_tag_', 0, NULL, @minLeft, @maxRight )
Comment 3 Leo 2011-10-05 07:35:09 UTC
(In reply to comment #2)
> (In reply to comment #0)
> Leo if you're running on mysql database could you provide the output of the
> following query?
> 
> SELECT * FROM Tags ORDER BY id LIMIT 10;

Here is it 

mysql> SELECT * FROM Tags ORDER BY id LIMIT 10;
+----+------+----------------------------+------+---------+-----+-----+
| id | pid  | name                       | icon | iconkde | lft | rgt |
+----+------+----------------------------+------+---------+-----+-----+
|  0 |   -1 | _Digikam_root_tag_         |    0 | NULL    |   1 | 178 |
|  1 |    0 | Cham                       |    0 | NULL    | 176 | 177 |
|  2 |    0 | _Digikam_Internal_Tags_    |    0 | NULL    | 132 | 175 |
|  3 |    2 | Need Resolving History     |    0 | NULL    | 173 | 174 |
|  4 |    2 | Need Tagging History Graph |    0 | NULL    | 171 | 172 |
|  5 |    2 | Original Version           |    0 | NULL    | 169 | 170 |
|  6 |    2 | Current Version            |    0 | NULL    | 167 | 168 |
|  7 |    2 | Intermediate Version       |    0 | NULL    | 165 | 166 |
|  8 |    2 | Version Always Visible     |    0 | NULL    | 163 | 164 |
|  9 |    2 | Scanned for Faces          |    0 | NULL    | 161 | 162 |
+----+------+----------------------------+------+---------+-----+-----+
10 rows in set (0.00 sec)
Comment 4 Dávid Andor 2011-10-10 17:15:53 UTC
I have same problem.
Here is my output
mysql [localhost] {andor} (digikam) > SELECT * FROM Tags ORDER BY id LIMIT 10;
+----+------+-------------------------+------+---------+-----+-----+
| id | pid  | name                    | icon | iconkde | lft | rgt |
+----+------+-------------------------+------+---------+-----+-----+
|  0 |   -1 | _Digikam_root_tag_      |    0 | NULL    |   1 |  94 |
|  1 |    0 | _Digikam_root_tag_      |    0 | NULL    |  44 |  93 |
|  2 |    1 | _Digikam_root_tag_      |    0 | NULL    |  45 |  92 |
|  3 |    2 | Zsani                   |    0 | NULL    |  90 |  91 |
|  4 |    0 | _Digikam_Internal_Tags_ |    0 | NULL    |   2 |  43 |
|  5 |    4 | Color Label None        |    0 | NULL    |  41 |  42 |
|  6 |    4 | Color Label Red         |    0 | NULL    |  39 |  40 |
|  7 |    4 | Color Label Orange      |    0 | NULL    |  37 |  38 |
|  8 |    4 | Color Label Yellow      |    0 | NULL    |  35 |  36 |
|  9 |    4 | Color Label Green       |    0 | NULL    |  33 |  34 |
+----+------+-------------------------+------+---------+-----+-----+
10 rows in set (0.00 sec)

mysql [localhost] {andor} (digikam) > SELECT * FROM TagsTree ORDER BY id LIMIT 10;
+----+------+
| id | pid  |
+----+------+
|  0 |   -1 |
|  1 |    0 |
|  2 |    1 |
|  3 |    2 |
|  4 |    0 |
|  5 |    4 |
|  6 |    4 |
|  7 |    4 |
|  8 |    4 |
|  9 |    4 |
+----+------+
Comment 5 Francesco Riosa 2011-10-10 17:42:52 UTC
(In reply to comment #4)
> I have same problem.
> Here is my output
> mysql [localhost] {andor} (digikam) > SELECT * FROM Tags ORDER BY id LIMIT 10;
> +----+------+-------------------------+------+---------+-----+-----+
> | id | pid  | name                    | icon | iconkde | lft | rgt |
> +----+------+-------------------------+------+---------+-----+-----+
> |  0 |   -1 | _Digikam_root_tag_      |    0 | NULL    |   1 |  94 |
> |  1 |    0 | _Digikam_root_tag_      |    0 | NULL    |  44 |  93 |
> |  2 |    1 | _Digikam_root_tag_      |    0 | NULL    |  45 |  92 |
> |  3 |    2 | Zsani                   |    0 | NULL    |  90 |  91 |

Please could you provide also the output of:
show create table Tags;

if there is an unique index on the `id` coulumn the 3 "_Digikam_root_tag_" should not be there, that, or the "no auto value on zero" statement failed
Comment 6 Dávid Andor 2011-10-10 18:05:12 UTC
CREATE TABLE `Tags` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `pid` int(11) DEFAULT NULL,
  `name` longtext CHARACTER SET utf8 NOT NULL,
  `icon` int(11) DEFAULT NULL,
  `iconkde` longtext CHARACTER SET utf8,
  `lft` int(11) NOT NULL,
  `rgt` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=47 DEFAULT CHARSET=latin1


show create table TagsTree;
CREATE ALGORITHM=UNDEFINED DEFINER=`andor`@`localhost` SQL SECURITY DEFINER VIEW `TagsTree` AS select `Tags`.`id` AS `id`,`Tags`.`pid` AS `pid` from `Tags`
Comment 7 Francesco Riosa 2011-10-10 18:31:11 UTC
(In reply to comment #6)
> CREATE TABLE `Tags` (
>   `id` int(11) NOT NULL AUTO_INCREMENT,
>   `pid` int(11) DEFAULT NULL,
>   `name` longtext CHARACTER SET utf8 NOT NULL,
>   `icon` int(11) DEFAULT NULL,
>   `iconkde` longtext CHARACTER SET utf8,
>   `lft` int(11) NOT NULL,
>   `rgt` int(11) NOT NULL,
>   PRIMARY KEY (`id`)
> ) ENGINE=MyISAM AUTO_INCREMENT=47 DEFAULT CHARSET=latin1
> 
> 
> show create table TagsTree;
> CREATE ALGORITHM=UNDEFINED DEFINER=`andor`@`localhost` SQL SECURITY DEFINER
> VIEW `TagsTree` AS select `Tags`.`id` AS `id`,`Tags`.`pid` AS `pid` from `Tags`

bad, the record is created by the following statements:

-- 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8<

SELECT
    @minLeft := IF(ISNULL(MIN(lft)), 1, MIN(lft)-1),
    @maxRight := IF(ISNULL(MAX(rgt)), 2, MAX(rgt)+1)
FROM Tags
WHERE id >= 0 AND pid>=0;

SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO';

REPLACE INTO Tags
    (id, pid, name, icon, iconkde, lft, rgt)
    VALUES
    (0, -1, '_Digikam_root_tag_', 0, NULL, @minLeft, @maxRight )
SET SQL_MODE=@OLD_SQL_MODE;

-- 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8<

The first select store in two variables the bounds of our tags tree.

The set stmt tell mysql not to assign a value to the id field even if it's zero, by default it increment a primary key column if the value inserted is zero or NULL

the replace stmt then should only alter (or insert) the record 0, never inserting a duplicate one.

Could I abuse of your kindeness and ask to manually run the statements between the scissors manually from a console client (phpmyadmin is not an option, it sometimes mangle @vars)

Does it add a new record?
If yes could you try replacing the replace with the following two?

INSERT IGNORE INTO Tags
    (id, pid, name, icon, iconkde, lft, rgt)
    VALUES
    (0, -1, '_Digikam_root_tag_', 0, NULL, @minLeft, @maxRight );

UPDATE Tags
SET
  lft = @minLeft,
  rgt = @maxRight
WHERE id = 0
;

Also the mysql version could be interesting.

just a closing note:
do _not_ delete the records from the table, it would broke the tree structure, do it from digikam if possible, if not we need to work on it too

thanks,
Francesco
Comment 8 Leo 2011-10-10 18:41:01 UTC
Sorry, but at the moment I cannot help you anymore, since I blocked by this bug :(
https://bugs.launchpad.net/ubuntu/+source/digikam/+bug/871597

Hope to help you as soon as possible
Comment 9 qwexy 2011-10-14 12:28:47 UTC
KDE 4.7.2 Digikam 2.2.0 Opensuse, mysql

Every tag hierarchy written to xmp into the photos starts with _Digikam_root_tag_/

That will lead to a doubled tag list in xmp, if the tag list allready exists without _Digikam_root_tag_/ at the beginning.

Can someone confirm this?
Comment 10 Dmitri Popov 2011-10-14 17:19:25 UTC
I can confirm that using MySQL as digiKam's back end results in a parallel _Digikam_root_tag_/ tagging structure. _Digikam_root_tag_ tags can be removed using the following command:

exiftool -xmp:LastKeywordXMP= -xmp:TagsList= -xmp:hierarchicalSubject= *.jpg
Comment 11 Martin Burnicki 2011-10-17 11:15:21 UTC
I'm also observing this with the DK 2.2.0 rpm package for openSUSE 11.4. I've been using mysql as database with DK 1.1.9 and have just upgraded to DK 2.2.0.

BTW, automatically upgrading the database from schema 5 to schema 6 still fails. I had to drop all tables in the DK database and let them be created from scratch to get DK working with mysql. :-(
Comment 12 Marcel Wiesweg 2011-10-29 15:23:21 UTC
I would like to direct commenters' focus to Francesco's comment #7, it seems he needs active help to debug this problem.
Comment 13 Michael Holtermann 2011-10-30 11:33:21 UTC
Created attachment 65041 [details]
Console output of mysql-statements from comment #7
Comment 14 Michael Holtermann 2011-10-30 11:35:07 UTC
(sorry for double post, this comments comment #13...)

Hi Francesco,

I've executed the statements, please see the attached console output.

Do you missed a semicolon after the 3rd statement (REPLACE INTO)? Executing at
is produces an error (line 33 ff.)

As far as I see the REPLACE does not produce a new node, so I did not execute
the INSERT IGNORE statement.

Please let me know, if any further information is needed.

My Mysql is 5.1.58-1ubuntu1.

Kind regards,
Michael
Comment 15 Francesco Riosa 2011-11-01 21:50:03 UTC
I've reproduced this with mysql-5.1.59, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' is not working, or it's not executed in the same connection as the insert.
Comment 16 Francesco Riosa 2011-11-01 21:56:23 UTC
(In reply to comment #15)
> I've reproduced this with mysql-5.1.59, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' is not
> working, or it's not executed in the same connection as the insert.

P.S. if consecutive query inside a <dbaction> tag are not executed in the same connection problem will arise in all query containing @variables, because these are local to the connection.
Comment 17 Francesco Riosa 2011-11-01 22:42:30 UTC
Question to someone experiencing the problem:

show create table Tags ;

look like this?

CREATE TABLE `tags` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `pid` int(11) DEFAULT NULL,
  `name` longtext NOT NULL,
  `icon` int(11) DEFAULT NULL,
  `iconkde` longtext,
  `lft` int(11) NOT NULL,
  `rgt` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2147483648 DEFAULT CHARSET=utf8

I'm interested expecially in the "AUTO_INCREMENT=2147483648" part
Comment 18 Francesco Riosa 2011-11-02 00:53:57 UTC
http://commits.kde.org/digikam/33dc55daee96bc68d4e7d9a286fcf7e78efd523e
first part of the fix
Comment 19 Leo 2011-11-02 15:19:20 UTC
Since the last update I'm running now the ubuntu version 2:2.1.1-0ubuntu1+kde 4.7.2 (whic does not have this problem anymore)
But if it could help
CREATE TABLE `Tags` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `pid` int(11) DEFAULT NULL,
 `name` longtext CHARACTER SET utf8 NOT NULL,
 `icon` int(11) DEFAULT NULL,
 `iconkde` longtext CHARACTER SET utf8,
 `lft` int(11) NOT NULL,
 `rgt` int(11) NOT NULL,
 PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=97 DEFAULT CHARSET=latin1
Comment 20 Michael Holtermann 2011-11-06 11:46:26 UTC
I've deleted the _digikam_root_tag_ from digikam and applied the reverse geocoding again. Now the tag is gone, at least, it does not re-appear again.

Digikam: 2:2.1.1-0ubuntu1
mysql: 5.1.58-1ubuntu1

But I had not to update digikam, I've installed Kubuntu 11.10 in mid-october with the named versions.

So there is a way to get rid of the tag manually by deleting it from digikam an re-applying geocoding.

mysql> show create table Tags ;

CREATE TABLE `Tags` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `pid` int(11) DEFAULT NULL,
  `name` longtext CHARACTER SET utf8 NOT NULL,
  `icon` int(11) DEFAULT NULL,
  `iconkde` longtext CHARACTER SET utf8,
  `lft` int(11) NOT NULL,
  `rgt` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=363 DEFAULT CHARSET=latin1
Comment 21 qwexy 2011-11-06 15:58:49 UTC
Hi Francesco,

The second issue (post #9) still exists with dk 2.2.0.-109.5
Can we help debugging somehow?

in reply to post #17:
AUTO_INCREMENT=983
BTW I never had a _Digikam_root_tag_ as tag in the tag list.
Comment 22 Michael Holtermann 2011-11-06 16:04:10 UTC
In comment #20 I removed the dummy tag. Now, while running some face recognition, the tag re-appears, with the "Unknown" tag below it.
Comment 23 qwexy 2011-11-06 16:32:52 UTC
in addition to comment #19

I guess, that somewhere in the sql statement (that puts together the tag hierarchy; I don't know how it works) is a condition (IF...), to stop the chaining after reaching "pid = 0". Maybe the IF THEN condition is supposed to stop before reaching "pid = 0".
Comment 24 Francesco Riosa 2011-11-06 17:07:34 UTC
I've discovered that the new tag is created as root of the "Persons", I've excluded a pair of things that could have created it, but not yet found the real bug
Comment 25 qwexy 2012-07-09 20:27:59 UTC
Hello,
In my database I did change in table "Tags" the entry "_Digikam_root_tag_"'s id 0 to -1.
This solved my issue.
Regards
Comment 26 Leo 2012-07-11 06:39:42 UTC
Hi all, 
I'm back my system got updated, but the problem persist :(
Ubuntu 12.04 LTS with digikam  4:2.7.0-precise~ppa3

mysql> SELECT * FROM Tags ORDER BY id LIMIT 10;
+----+------+----------------------------+------+---------+-----+-----+
| id | pid  | name                       | icon | iconkde | lft | rgt |
+----+------+----------------------------+------+---------+-----+-----+
|  0 |   -1 | _Digikam_root_tag_         |    0 | NULL    |   1 |  60 |
|  1 |    0 | _Digikam_Internal_Tags_    |    0 | NULL    |  16 |  59 |
|  2 |    1 | Need Resolving History     |    0 | NULL    |  57 |  58 |
|  3 |    0 | Cham                       |    0 | NULL    |  14 |  15 |
|  4 |    1 | Need Tagging History Graph |    0 | NULL    |  55 |  56 |
|  5 |    1 | Original Version           |    0 | NULL    |  53 |  54 |
|  6 |    1 | Current Version            |    0 | NULL    |  51 |  52 |
|  7 |    1 | Intermediate Version       |    0 | NULL    |  49 |  50 |
|  8 |    1 | Version Always Visible     |    0 | NULL    |  47 |  48 |
|  9 |    1 | Color Label None           |    0 | NULL    |  45 |  46 |
+----+------+----------------------------+------+---------+-----+-----+
10 rows in set (0.00 sec)

mysql> SELECT * FROM TagsTree ORDER BY id LIMIT 10;
+----+------+
| id | pid  |
+----+------+
|  0 |   -1 |
|  1 |    0 |
|  2 |    1 |
|  3 |    0 |
|  4 |    1 |
|  5 |    1 |
|  6 |    1 |
|  7 |    1 |
|  8 |    1 |
|  9 |    1 |
+----+------+
10 rows in set (0.02 sec)
Comment 27 schultzter 2012-07-15 14:58:46 UTC
This still seems to be happening in 2.7.0! mysql  Ver 14.14 Distrib 5.5.24, On Slackware64-current

mysql> select * from Tags where name='_Digikam_root_tag_';
+-----+------+--------------------+------+---------+-----+-----+
| id  | pid  | name               | icon | iconkde | lft | rgt |
+-----+------+--------------------+------+---------+-----+-----+
|   0 |   -1 | _Digikam_root_tag_ |    0 | NULL    |   1 | 290 |
| 138 |    0 | _Digikam_root_tag_ |    0 | NULL    |   2 |  15 |
+-----+------+--------------------+------+---------+-----+-----+
2 rows in set (0.00 sec)

The worst part is I had tagged a bunch of photos with me before I realised my tag appear twice in the tag list. So I tried to drag 'n drop the photos from the duplicate tag to the original one and somewhere in that maneuver I lost both the original and duplicate assignment!

So how can I re-scan those photos and get digikam to re-find my face?
Comment 28 Michael Holtermann 2012-07-28 21:40:05 UTC
I can confirm the problem still exists in 2.7.0 (installed from http://ppa.launchpad.net/philip5/extra/ubuntu/ at Ubuntu 12.04).

I've tried to re-read metadata from images - that creates a new _digikam_root_tag_. If a imported tag exists under another branch already, it's impossible to remove the messed stuff from the images itself.

May I suggest to get rid of the internal tags at all? There are two alternative options that don't need any "magic" tags that must be hidden from most parts of the software:

a) a real root tag that must be created by the user
b) no root tags at all

Option a) would make it necessary to mark that tag as "uninteresting", so it won't be written to the JPG or sidecar files. But this must be an *explicit* setting, maybe during setup wizard. And not some implicit c**p.

Rule of thumb: If the user don't see it - don't store it :-)

BTW: This would be a nice feature for any other tag as well. If set on a tag, that tag won't be exposed to the images. So the user may create a semantic tree, but skip some structural nodes.

Option b) would make it necessary to allow nulls in column Tags.pid. But who says a tree must start with a single root?

Please think about it. The internal tags causes lots of problems to the users, so this should be solved in the very near future.

Currently, I'd consider this the most annoying bug in the whole software.

Because of another issue, I have to rebuild my tag database. That's nearly impossible for 25.000 images with this issue still present.

Regards, Michael
Comment 29 e.longuemare 2012-11-09 16:10:21 UTC
Hello,

I've got the same problem with digikam 2.8.0 from Philips PPA (xubuntu 12.04).
I've tried from mysql 5.1.61 and mysql 5.5.28-0ubuntu0.12.04.2, always the same.
Cleaning the tags and rewrite it to image, the tag _Digikam_root_tag is always there.
+ this "bugs" :
so tagging is not usable.

Query Output:
> SELECT * FROM digikam.Tags ORDER BY id LIMIT 10

+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
| id      | pid      | name      | icon      | iconkde      | lft      | rgt      |
+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
| 0       | -1       | _Digikam_root_tag_ | 0         |              | 1        | 542      |
| 1       | 0        | _Digikam_root_tag_ | 0         |              | 246      | 541      |
| 2       | 1        | lieu      | 0         |              | 461      | 540      |
| 3       | 2        | capblancnez | 0         |              | 538      | 539      |
| 4       | 0        | _Digikam_Internal_Tags_ | 0         |              | 204      | 245      |
| 5       | 4        | Color Label None | 0         |              | 243      | 244      |
| 6       | 4        | Color Label Red | 0         |              | 241      | 242      |
| 7       | 4        | Color Label Orange | 0         |              | 239      | 240      |
| 8       | 4        | Color Label Yellow | 0         |              | 237      | 238      |
| 9       | 4        | Color Label Green | 0         |              | 235      | 236      |
| NULL    | NULL     | NULL      | NULL      | NULL         | NULL     | NULL     |
+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
11 rows

Query Output:
> show create table digikam.TagsTree

+ --------- + ---------------- + ------------------------- + ------------------------- +
| View      | Create View      | character_set_client      | collation_connection      |
+ --------- + ---------------- + ------------------------- + ------------------------- +
| TagsTree  | CREATE ALGORITHM=UNDEFINED DEFINER=`sospcdk`@`192.168.1.10` SQL SECURITY DEFINER VIEW `digikam`.`TagsTree` AS select `digikam`.`Tags`.`id` AS `id`,`digikam`.`Tags`.`pid` AS `pid` from `digikam`.`Tags` | utf8                      | utf8_general_ci           |
+ --------- + ---------------- + ------------------------- + ------------------------- +
1 rows

Is there a solution ?

Greatings,

Eric
Comment 30 e.longuemare 2012-11-09 16:59:23 UTC
Hello,

I have a mix of this bug and this one : https://bugs.kde.org/show_bug.cgi?id=230602
So tagging is not usable.

As I try to reorder the tree view of the tags (Same tags are in a first tree with _Digikam_root_tag and to root with same pictures in multiple branches or not ?), this bug occurs : https://bugs.kde.org/show_bug.cgi?id=230602)

Greatings,

Eric
Comment 31 e.longuemare 2012-11-09 17:07:12 UTC
TagsTree view :

> SELECT * FROM digikam.TagsTree ORDER BY id LIMIT 10

+ ------- + -------- +
| id      | pid      |
+ ------- + -------- +
| 0       | -1       |
| 1       | 0        |
| 2       | 1        |
| 3       | 2        |
| 4       | 0        |
| 5       | 4        |
| 6       | 4        |
| 7       | 4        |
| 8       | 4        |
| 9       | 4        |
+ ------- + -------- +
10 rows
Comment 32 e.longuemare 2012-11-09 19:31:08 UTC
> show create table digikam.Tags

+ ---------- + ----------------- +
| Table      | Create Table      |
+ ---------- + ----------------- +
| Tags       | CREATE TABLE `Tags` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `pid` int(11) DEFAULT NULL,
  `name` longtext CHARACTER SET utf8 NOT NULL,
  `icon` int(11) DEFAULT NULL,
  `iconkde` longtext CHARACTER SET utf8,
  `lft` int(11) NOT NULL,
  `rgt` int(11) N... |
+ ---------- + ----------------- +
Comment 33 e.longuemare 2012-11-09 19:52:19 UTC
Diff between /usr/share/kde4/apps/database/dbconfig.xml in my digikam database conf file and the dbconfig.xml given by Francesco :
1 / /usr/share/kde4/apps/database/dbconfig.xml
2 /  dbconfig.xml given by Francesco 

line 908 :
1 / CREATE PROCEDURE create_index_if_not_exists(table_name_vc varchar(50), index_name_vc varchar(50), field_list_vc varchar(1024))
2 / CREATE PROCEDURE create_index_if_not_exists(table_name_vc varchar(50), index_name_vc varchar(50), field_list_vc varchar(1024), is_unique int)
line 924 :
1 / CONVERT( ' ADD INDEX ' USING latin1),
2 /  CONVERT( IF(is_unique = 0, ' ADD INDEX ', ' ADD UNIQUE INDEX ') USING latin1),
line 936 to 950 :
1/
<statement mode="plain">CALL create_index_if_not_exists('Images','dir_index','album');</statement>
                <statement mode="plain">CALL create_index_if_not_exists('Images','hash_index','uniqueHash');</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageTags','tag_index','tagid');</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageTags','tag_id_index','imageid');</statement>
                <statement mode="plain">CALL create_index_if_not_exists('Images','image_name_index','name(996)');</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageInformation','creationdate_index','creationDate');</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageComments','comments_imageid_index','imageid');</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageCopyright','copyright_imageid_index','imageid');</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageHistory','uuid_index','uuid');</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageRelations','subject_relations_index','subject');</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageRelations','object_relations_index','object');</statement>
                <statement mode="plain">CALL create_index_if_not_exists('TagProperties','tagproperties_index','tagid');</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageTagProperties','imagetagproperties_index','imageid, tagid');</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageTagProperties','imagetagproperties_imageid_index','imageid');</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageTagProperties','imagetagproperties_tagid_index','tagid');</statement>
2 / 
<statement mode="plain">CALL create_index_if_not_exists('Images','dir_index','album', 0);</statement>
                <statement mode="plain">CALL create_index_if_not_exists('Images','hash_index','uniqueHash', 0);</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageTags','tag_index','tagid', 0);</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageTags','tag_id_index','imageid', 0);</statement>
                <statement mode="plain">CALL create_index_if_not_exists('Images','image_name_index','name(996)', 0);</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageInformation','creationdate_index','creationDate', 0);</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageComments','comments_imageid_index','imageid', 0);</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageCopyright','copyright_imageid_index','imageid', 0);</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageHistory','uuid_index','uuid', 0);</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageRelations','subject_relations_index','subject', 0);</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageRelations','object_relations_index','object', 0);</statement>
                <statement mode="plain">CALL create_index_if_not_exists('TagProperties','tagproperties_index','tagid', 0);</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageTagProperties','imagetagproperties_index','imageid, tagid', 0);</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageTagProperties','imagetagproperties_imageid_index','imageid', 0);</statement>
                <statement mode="plain">CALL create_index_if_not_exists('ImageTagProperties','imagetagproperties_tagid_index','tagid', 0);</statement>

line 989  + one more line for 2 (not in 1):
1 /  <statement mode="plain">SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO';</statement>
2 / <statement mode="plain">SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO';</statement>
            <statement mode="plain">UPDATE tags SET pid = 0 WHERE pid &lt; 0 AND id &gt; 0;</statement>

line 995 :
1 / <statement mode="plain">SET SQL_MODE=@OLD_SQL_MODE;</statement>
2 / not in Francesco File

line 1236 :
1 /CREATE PROCEDURE create_index_if_not_exists(table_name_vc varchar(50), index_name_vc varchar(50), field_list_vc varchar(1024))
2 / CREATE PROCEDURE create_index_if_not_exists(table_name_vc varchar(50), index_name_vc varchar(50), field_list_vc varchar(1024), is_unique int)

line 1252 :
1 / CONVERT( ' ADD INDEX ' USING latin1),
2 / CONVERT( IF(is_unique = 0, ' ADD INDEX ', ' ADD UNIQUE INDEX ') USING latin1),

line 1264 to 1266 :
1 /
<statement mode="plain">CALL create_index_if_not_exists('UniqueHashes','id_uniqueHashes','thumbId');</statement>
                <statement mode="plain">CALL create_index_if_not_exists('FilePaths','id_filePaths','thumbId');</statement>
                <statement mode="plain">CALL create_index_if_not_exists('CustomIdentifiers','id_customIdentifiers','thumbId');</statement>
2 /
<statement mode="plain">CALL create_index_if_not_exists('UniqueHashes','id_uniqueHashes','thumbId', 0);</statement>
                <statement mode="plain">CALL create_index_if_not_exists('FilePaths','id_filePaths','thumbId', 0);</statement>
                <statement mode="plain">CALL create_index_if_not_exists('CustomIdentifiers','id_customIdentifiers','thumbId', 0);</statement>

line 1493 :
1 / not in file
2 / <statement mode="plain">CALL create_index_if_not_exists('Tags','name_pid_index','name(128), pid', 1);</statement>

Greatings,
Eric
Comment 34 e.longuemare 2012-11-09 19:56:49 UTC
No diff for QSQLITE, the only diffs are on QMYSQL.
Comment 35 e.longuemare 2012-11-10 10:46:37 UTC
Hello,

Francesco give this in bugs [Bug 299173] http://mail.kde.org/pipermail/digikam-devel/2012-May/060073.html with this link :
http://www.sitepoint.com/hierarchical-data-database-2/

This is my table Tags order by left values :

Query Output:
>  SELECT * FROM digikam.Tags ORDER BY lft

+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
| id      | pid      | name      | icon      | iconkde      | lft      | rgt      |
+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
| 0       | -1       | _Digikam_root_tag_ | 0         |              | 1        | 542      |
| 270     | 0        | Personnes | 0         |              | 2        | 3        |
| 251     | 0        | ver       | 0         |              | 4        | 7        |
| 252     | 251      | nereis    | 0         |              | 5        | 6        |
| 231     | 0        | poisson2  | 0         |              | 8        | 15       |
| 260     | 231      | brochet   | 0         |              | 9        | 10       |
| 242     | 231      | merlan    | 0         |              | 11       | 12       |
| 232     | 231      | grande castagnole | 0         |              | 13       | 14       |
| 206     | 0        | ver coréen | 0         |              | 16       | 17       |
| 124     | 0        | plomb grappin | 0         |              | 18       | 19       |
| 112     | 0        | vegetal   | 0         |              | 20       | 27       |
| 191     | 112      | fleur     | 0         |              | 21       | 24       |
| 192     | 191      | perceneige | 0         |              | 22       | 23       |
| 113     | 112      | algue     | 0         |              | 25       | 26       |
| 99      | 0        | trombine2 | 0         |              | 28       | 35       |
| 238     | 99       | gribouille | 0         |              | 29       | 30       |
| 141     | 99       | xavier    | 0         |              | 31       | 32       |
| 100     | 99       | eric      | 0         |              | 33       | 34       |
| 96      | 0        | lieu2     | 0         |              | 36       | 51       |
| 263     | 96       | vendee    | 0         |              | 37       | 38       |
| 226     | 96       | mormal    | 0         |              | 39       | 40       |
| 182     | 96       | cessenonorb | 0         |              | 41       | 42       |
| 154     | 96       | lestouches | 0         |              | 43       | 44       |
| 140     | 96       | saumonard | 0         |              | 45       | 46       |
| 122     | 96       | bretignolles la sauzaie | 0         |              | 47       | 48       |
| 97      | 96       | Chevret   | 0         |              | 49       | 50       |
| 55      | 0        | lieu      | 0         |              | 52       | 73       |
| 250     | 55       | chassiron | 0         |              | 53       | 54       |
| 228     | 55       | tournehem | 0         |              | 55       | 56       |
| 218     | 55       | dyck      | 0         |              | 57       | 58       |
| 209     | 55       | riumar    | 0         |              | 59       | 60       |
| 205     | 55       | platja de la marquesa | 0         |              | 61       | 62       |
| 200     | 55       | creche    | 0         |              | 63       | 64       |
| 198     | 55       | cranpoulet | 0         |              | 65       | 66       |
| 197     | 55       | cranauxoeufs | 0         |              | 67       | 68       |
| 142     | 55       | fort boyard | 0         |              | 69       | 70       |
| 56      | 55       | salsperwick | 0         |              | 71       | 72       |
| 49      | 0        | poisson   | 0         |              | 74       | 101      |
| 258     | 49       | brochet   | 0         |              | 75       | 76       |
| 247     | 49       | marbré   | 0         |              | 77       | 78       |
| 240     | 49       | merlan    | 0         |              | 79       | 80       |
| 236     | 49       | flet      | 0         |              | 81       | 82       |
| 229     | 49       | grande castagnole | 0         |              | 83       | 84       |
| 216     | 49       | girelle   | 0         |              | 85       | 86       |
| 214     | 49       | sar       | 0         |              | 87       | 88       |
| 211     | 49       | mulet     | 0         |              | 89       | 90       |
| 203     | 49       | sardine   | 0         |              | 91       | 92       |
| 137     | 49       | tacaud    | 0         |              | 93       | 94       |
| 118     | 49       | maquereau | 0         |              | 95       | 96       |
| 116     | 49       | lancon    | 0         |              | 97       | 98       |
| 50      | 49       | anguille  | 0         |              | 99       | 100      |
| 45      | 0        | animal    | 0         |              | 102      | 181      |
| 46      | 45       | vertebre  | 0         |              | 103      | 180      |
| 150     | 46       | reptile   | 0         |              | 104      | 109      |
| 158     | 150      | lezard    | 0         |              | 105      | 106      |
| 151     | 150      | grenouille | 0         |              | 107      | 108      |
| 61      | 46       | mammifere | 0         |              | 110      | 119      |
| 234     | 61       | herisson  | 0         |              | 111      | 112      |
| 163     | 61       | ane       | 0         |              | 113      | 114      |
| 161     | 61       | cheval    | 0         |              | 115      | 116      |
| 62      | 61       | mouton    | 0         |              | 117      | 118      |
| 58      | 46       | oiseau    | 0         |              | 120      | 135      |
| 169     | 58       | aigrette  | 0         |              | 121      | 122      |
| 167     | 58       | vanneau   | 0         |              | 123      | 124      |
| 160     | 58       | heron     | 0         |              | 125      | 126      |
| 156     | 58       | hirondelle | 0         |              | 127      | 128      |
| 153     | 58       | cigogne   | 0         |              | 129      | 130      |
| 60      | 58       | canard    | 0         |              | 131      | 132      |
| 59      | 58       | cygne     | 0         |              | 133      | 134      |
| 47      | 46       | poisson   | 0         |              | 136      | 179      |
| 259     | 47       | brochet   | 0         |              | 137      | 138      |
| 248     | 47       | marbré   | 0         |              | 139      | 140      |
| 241     | 47       | merlan    | 0         |              | 141      | 142      |
| 237     | 47       | flet      | 0         |              | 143      | 144      |
| 230     | 47       | grande castagnole | 0         |              | 145      | 146      |
| 217     | 47       | girelle   | 0         |              | 147      | 148      |
| 215     | 47       | sar       | 0         |              | 149      | 150      |
| 212     | 47       | mulet     | 0         |              | 151      | 152      |
| 204     | 47       | sardine   | 0         |              | 153      | 154      |
| 173     | 47       | maigre    | 0         |              | 155      | 156      |
| 139     | 47       | tacaud    | 0         |              | 157      | 158      |
| 128     | 47       | cabillaud | 0         |              | 159      | 160      |
| 123     | 47       | turbot    | 0         |              | 161      | 162      |
| 119     | 47       | maquereau | 0         |              | 163      | 164      |
| 117     | 47       | lancon    | 0         |              | 165      | 166      |
| 107     | 47       | petite roussette | 0         |              | 167      | 168      |
| 105     | 47       | vieille   | 0         |              | 169      | 170      |
| 98      | 47       | raie      | 0         |              | 171      | 172      |
| 90      | 47       | sole      | 0         |              | 173      | 174      |
| 51      | 47       | anguille  | 0         |              | 175      | 176      |
| 48      | 47       | bar       | 0         |              | 177      | 178      |
| 38      | 0        | materiel  | 0         |              | 182      | 191      |
| 143     | 38       | tente     | 0         |              | 183      | 184      |
| 127     | 38       | plomb grappin | 0         |              | 185      | 186      |
| 39      | 38       | vehicule  | 0         |              | 187      | 190      |
| 40      | 39       | volvo-240 | 0         |              | 188      | 189      |
| 25      | 0        | trombine  | 0         |              | 192      | 199      |
| 57      | 25       | gonzague  | 0         |              | 193      | 194      |
| 27      | 25       | gribouille | 0         |              | 195      | 196      |
| 26      | 25       | eric      | 0         |              | 197      | 198      |
| 24      | 0        | gribouille | 0         |              | 200      | 201      |
| 23      | 0        | eric      | 0         |              | 202      | 203      |
| 4       | 0        | _Digikam_Internal_Tags_ | 0         |              | 204      | 245      |
| 269     | 4        | Version Always Visible | 0         |              | 205      | 206      |
| 268     | 4        | Intermediate Version | 0         |              | 207      | 208      |
| 267     | 4        | Current Version | 0         |              | 209      | 210      |
| 266     | 4        | Original Version | 0         |              | 211      | 212      |
| 265     | 4        | Need Tagging History Graph | 0         |              | 213      | 214      |
| 194     | 4        | Need Resolving History | 0         |              | 215      | 216      |
| 18      | 4        | Pick Label Accepted | 0         |              | 217      | 218      |
| 17      | 4        | Pick Label Pending | 0         |              | 219      | 220      |
| 16      | 4        | Pick Label Rejected | 0         |              | 221      | 222      |
| 15      | 4        | Pick Label None | 0         |              | 223      | 224      |
| 14      | 4        | Color Label White | 0         |              | 225      | 226      |
| 13      | 4        | Color Label Black | 0         |              | 227      | 228      |
| 12      | 4        | Color Label Gray | 0         |              | 229      | 230      |
| 11      | 4        | Color Label Magenta | 0         |              | 231      | 232      |
| 10      | 4        | Color Label Blue | 0         |              | 233      | 234      |
| 9       | 4        | Color Label Green | 0         |              | 235      | 236      |
| 8       | 4        | Color Label Yellow | 0         |              | 237      | 238      |
| 7       | 4        | Color Label Orange | 0         |              | 239      | 240      |
| 6       | 4        | Color Label Red | 0         |              | 241      | 242      |
| 5       | 4        | Color Label None | 0         |              | 243      | 244      |
| 1       | 0        | _Digikam_root_tag_ | 0         |              | 246      | 541      |
| 165     | 1        | vegetal   | 0         |              | 247      | 254      |
| 179     | 165      | vigne     | 0         |              | 248      | 249      |
| 166     | 165      | fleur     | 0         |              | 250      | 253      |
| 180     | 166      | coquelicot | 0         |              | 251      | 252      |
| 148     | 1        | reptile   | 0         |              | 255      | 260      |
| 157     | 148      | lezard    | 0         |              | 256      | 257      |
| 149     | 148      | grenouille | 0         |              | 258      | 259      |
| 110     | 1        | vegetaux  | 0         |              | 261      | 268      |
| 189     | 110      | fleur     | 0         |              | 262      | 265      |
| 190     | 189      | perceneige | 0         |              | 263      | 264      |
| 111     | 110      | algue     | 0         |              | 266      | 267      |
| 108     | 1        | volvo-240 | 0         |              | 269      | 270      |
| 92      | 1        | arenicole | 0         |              | 271      | 272      |
| 43      | 1        | poisson   | 0         |              | 273      | 290      |
| 172     | 43       | maigre    | 0         |              | 274      | 275      |
| 126     | 43       | cabillaud | 0         |              | 276      | 277      |
| 121     | 43       | turbot    | 0         |              | 278      | 279      |
| 106     | 43       | petite roussette | 0         |              | 280      | 281      |
| 104     | 43       | vieille   | 0         |              | 282      | 283      |
| 95      | 43       | raie      | 0         |              | 284      | 285      |
| 89      | 43       | sole      | 0         |              | 286      | 287      |
| 44      | 43       | bar       | 0         |              | 288      | 289      |
| 41      | 1        | trombine  | 0         |              | 291      | 342      |
| 264     | 41       | matthis   | 0         |              | 292      | 293      |
| 246     | 41       | hassan    | 0         |              | 294      | 295      |
| 245     | 41       | mathias   | 0         |              | 296      | 297      |
| 244     | 41       | phil      | 0         |              | 298      | 299      |
| 219     | 41       | julien    | 0         |              | 300      | 301      |
| 210     | 41       | florian   | 0         |              | 302      | 303      |
| 199     | 41       | jenny     | 0         |              | 304      | 305      |
| 184     | 41       | oxanne    | 0         |              | 306      | 307      |
| 170     | 41       | crapule   | 0         |              | 308      | 309      |
| 155     | 41       | vincent   | 0         |              | 310      | 311      |
| 138     | 41       | xavier    | 0         |              | 312      | 313      |
| 135     | 41       | magalie   | 0         |              | 314      | 315      |
| 133     | 41       | francoise | 0         |              | 316      | 317      |
| 132     | 41       | andre     | 0         |              | 318      | 319      |
| 80      | 41       | whitney   | 0         |              | 320      | 321      |
| 79      | 41       | kenzo     | 0         |              | 322      | 323      |
| 75      | 41       | viviane   | 0         |              | 324      | 325      |
| 74      | 41       | joel      | 0         |              | 326      | 327      |
| 73      | 41       | simba     | 0         |              | 328      | 329      |
| 71      | 41       | allan     | 0         |              | 330      | 331      |
| 69      | 41       | anais     | 0         |              | 332      | 333      |
| 67      | 41       | chloe     | 0         |              | 334      | 335      |
| 54      | 41       | christelle | 0         |              | 336      | 337      |
| 52      | 41       | charlotte | 0         |              | 338      | 339      |
| 42      | 41       | marco     | 0         |              | 340      | 341      |
| 33      | 1        | _Digikam_root_tag_ | 0         |              | 343      | 368      |
| 34      | 33       | animal    | 0         |              | 344      | 367      |
| 63      | 34       | vertebre  | 0         |              | 345      | 356      |
| 64      | 63       | mammifere | 0         |              | 346      | 355      |
| 235     | 64       | herisson  | 0         |              | 347      | 348      |
| 164     | 64       | ane       | 0         |              | 349      | 350      |
| 162     | 64       | cheval    | 0         |              | 351      | 352      |
| 65      | 64       | mouton    | 0         |              | 353      | 354      |
| 35      | 34       | invertebre | 0         |              | 357      | 366      |
| 36      | 35       | crustace  | 0         |              | 358      | 365      |
| 103     | 36       | araigneedemer | 0         |              | 359      | 360      |
| 102     | 36       | araignéedemer | 0         |              | 361      | 362      |
| 37      | 36       | callianasse | 0         |              | 363      | 364      |
| 31      | 1        | crustace  | 0         |              | 369      | 374      |
| 101     | 31       | araignéedemer | 0         |              | 370      | 371      |
| 32      | 31       | callianasse | 0         |              | 372      | 373      |
| 19      | 1        | animal    | 0         |              | 375      | 460      |
| 84      | 19       | invertebre | 0         |              | 376      | 421      |
| 187     | 84       | crustace  | 0         |              | 377      | 380      |
| 188     | 187      | crabe     | 0         |              | 378      | 379      |
| 171     | 84       | insecte   | 0         |              | 381      | 384      |
| 193     | 171      | coccinelle | 0         |              | 382      | 383      |
| 114     | 84       | cnidaire  | 0         |              | 385      | 390      |
| 145     | 114      | etoile de mer | 0         |              | 386      | 387      |
| 115     | 114      | anemone   | 0         |              | 388      | 389      |
| 93      | 84       | mollusque | 0         |              | 391      | 412      |
| 257     | 93       | buccin    | 0         |              | 392      | 393      |
| 256     | 93       | littorine | 0         |              | 394      | 395      |
| 255     | 93       | patelle   | 0         |              | 396      | 397      |
| 254     | 93       | huitre    | 0         |              | 398      | 399      |
| 249     | 93       | crepidule | 0         |              | 400      | 401      |
| 213     | 93       | telline   | 0         |              | 402      | 403      |
| 208     | 93       | praire    | 0         |              | 404      | 405      |
| 196     | 93       | couteau   | 0         |              | 406      | 407      |
| 195     | 93       | coque     | 0         |              | 408      | 409      |
| 94      | 93       | moule     | 0         |              | 410      | 411      |
| 85      | 84       | ver       | 0         |              | 413      | 420      |
| 253     | 85       | nereis    | 0         |              | 414      | 415      |
| 207     | 85       | ver coréen | 0         |              | 416      | 417      |
| 86      | 85       | arenicole | 0         |              | 418      | 419      |
| 20      | 19       | vertebre  | 0         |              | 422      | 459      |
| 77      | 20       | poisson   | 0         |              | 423      | 430      |
| 239     | 77       | congre    | 0         |              | 424      | 425      |
| 109     | 77       | emissole  | 0         |              | 426      | 427      |
| 78      | 77       | dorade    | 0         |              | 428      | 429      |
| 28      | 20       | oiseau    | 0         |              | 431      | 442      |
| 261     | 28       | paon      | 0         |              | 432      | 433      |
| 225     | 28       | sitelle   | 0         |              | 434      | 435      |
| 168     | 28       | rapace    | 0         |              | 436      | 437      |
| 68      | 28       | faisan    | 0         |              | 438      | 439      |
| 29      | 28       | goeland   | 0         |              | 440      | 441      |
| 21      | 20       | mammifere | 0         |              | 443      | 458      |
| 262     | 21       | ragondin  | 0         |              | 444      | 445      |
| 227     | 21       | cerf-biche | 0         |              | 446      | 447      |
| 202     | 21       | chevreuil | 0         |              | 448      | 449      |
| 181     | 21       | chat      | 0         |              | 450      | 451      |
| 159     | 21       | vache     | 0         |              | 452      | 453      |
| 83      | 21       | sanglier  | 0         |              | 454      | 455      |
| 22      | 21       | mustelide | 0         |              | 456      | 457      |
| 2       | 1        | lieu      | 0         |              | 461      | 540      |
| 243     | 2        | dakhla    | 0         |              | 462      | 463      |
| 233     | 2        | Jetee du dyck | 0         |              | 464      | 465      |
| 224     | 2        | Minerve   | 0         |              | 466      | 467      |
| 223     | 2        | Sigean    | 0         |              | 468      | 469      |
| 222     | 2        | Santiago  | 0         |              | 470      | 471      |
| 221     | 2        | San Francisco | 0         |              | 472      | 473      |
| 220     | 2        | Torreira  | 0         |              | 474      | 475      |
| 201     | 2        | crecy     | 0         |              | 476      | 477      |
| 186     | 2        | clipon    | 0         |              | 478      | 479      |
| 185     | 2        | berlou    | 0         |              | 480      | 481      |
| 183     | 2        | sete      | 0         |              | 482      | 483      |
| 178     | 2        | cahors    | 0         |              | 484      | 485      |
| 177     | 2        | vendee    | 0         |              | 486      | 487      |
| 176     | 2        | pointe de la coubre | 0         |              | 488      | 489      |
| 175     | 2        | vert bois | 0         |              | 490      | 491      |
| 174     | 2        | pointedegatseau | 0         |              | 492      | 493      |
| 152     | 2        | embellie  | 0         |              | 494      | 495      |
| 147     | 2        | lestouches | 0         |              | 496      | 497      |
| 146     | 2        | pointeespagnole | 0         |              | 498      | 499      |
| 144     | 2        | ronce les bains | 0         |              | 500      | 501      |
| 136     | 2        | saumonard | 0         |              | 502      | 503      |
| 134     | 2        | cessenonorb | 0         |              | 504      | 505      |
| 131     | 2        | dauphinbleu | 0         |              | 506      | 507      |
| 130     | 2        | carnot    | 0         |              | 508      | 509      |
| 129     | 2        | capgrisnez | 0         |              | 510      | 511      |
| 125     | 2        | ruytingen | 0         |              | 512      | 513      |
| 120     | 2        | bretignolles la sauzaie | 0         |              | 514      | 515      |
| 91      | 2        | Chevret   | 0         |              | 516      | 517      |
| 88      | 2        | rondins gravelines | 0         |              | 518      | 519      |
| 87      | 2        | dunkerque | 0         |              | 520      | 521      |
| 82      | 2        | mormal    | 0         |              | 522      | 523      |
| 81      | 2        | annoeullin | 0         |              | 524      | 525      |
| 76      | 2        | Vendres   | 0         |              | 526      | 527      |
| 72      | 2        | cazedarnes | 0         |              | 528      | 529      |
| 70      | 2        | gorgedheric | 0         |              | 530      | 531      |
| 66      | 55       | amsterdam | 0         |              | 532      | 533      |
| 53      | 2        | oye plage | 0         |              | 534      | 535      |
| 30      | 2        | diguebreak | 0         |              | 536      | 537      |
| 3       | 2        | capblancnez | 0         |              | 538      | 539      |
| NULL    | NULL     | NULL      | NULL      | NULL         | NULL     | NULL     |
+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
272 rows

There must not be two _Digikam_root_tag.
The second _Digikam_root_tag has a left value of 246 and a right value of 541.

This mean I think that it has been created after the first one with incorrect left and right values. 
This occur every time I created a new Digikam database in all the case :
- One database for Digikam data and thumbs data.
- two database, one for digikam data and one for thumbs data.
- new fresh install of mysql server and linux with different versions.
- Database or Databases are always on a remote server in my local network

Why ?

I continue to search .

Greatings,

Eric
Comment 36 e.longuemare 2012-11-10 14:47:19 UTC
Hello,
This is what is read for a picture with two tags "_Digikam_root_tag" and some other tags with no "_Digikam_root_tag", using /Album/reread metadata :
---
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::getXmpTagStringSeq: XMP String Seq ( Xmp.digiKam.TagsList ):  ("_Digikam_root_tag_/lieu/lestouches", "lieu/lestouches", "animal/vertebre/mammifere/ane", "lestouches", "animal", "animal/vertebre", "animal/vertebre/mammifere", "lieu2/lestouches", "_Digikam_root_tag_/_Digikam_root_tag_/animal", "_Digikam_root_tag_/_Digikam_root_tag_/animal/vertebre", "_Digikam_root_tag_/_Digikam_root_tag_/animal/vertebre/mammifere", "_Digikam_root_tag_/_Digikam_root_tag_/lieu/lestouches", "_Digikam_root_tag_/lieu2/lestouches", "_Digikam_root_tag_/_Digikam_root_tag_/animal/vertebre/mammifere/ane")
---

This is the list of Digikam Component : (/help/view component)
--
digiKam version 2.8.0
Codec PGF parallélisé: Non
Composant graphique Marble: 0.13.4 (stable release)
Dématriçage parallélisé: Oui
Exiv2 peut écrire dans un fichier JP2: Oui
Exiv2 peut écrire dans un fichier JPEG: Oui
Exiv2 peut écrire dans un fichier PGF: Oui
Exiv2 peut écrire dans un fichier PNG: Oui
Exiv2 peut écrire dans un fichier TIFF: Oui
Exiv2 prend en charge les métadonnées XMP: Oui
LibCImg: 130
LibClapack: bibliothèque interne
LibExiv2: 0.23
LibJPEG: 80
LibJasper: 1.900.1
LibKDE: 4.8.5 (4.8.5)
LibKExiv2: 2.3.0
LibKGeoMap: 2.0.0
LibKdcraw: 2.1.0
LibLCMS: 2020
LibLensFun: bibliothèque partagée externe
LibLqr: bibliothèque interne
LibPGF: 6.12.27 - bibliothèque interne
LibPNG: 1.2.46
LibQt: 4.8.1
LibRaw: 0.14.7
LibTIFF: LIBTIFF, Version 3.9.5 Copyright (c) 1988-1996 Sam Leffler Copyright (c) 1991-1996 Silicon Graphics, Inc.
LibGphoto2: 2.4.14
LibKface: 2.0.0
LibKipi: 1.6.0
LibOpenCV: 2.4.2
Libface: 0.2
Moteur de base de données: QMYSQL
Serveur interne de base de données: Non
--

Greatings,

Eric
Comment 37 e.longuemare 2012-11-10 15:14:00 UTC
Hello again,

Logs from Digikam :
-------- supress wrongs tags : sub from _Digikam_root_tag and apply
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::KExiv2Priv::printExiv2MessageHandler: Exiv2 ( 2 ) :  Directory Minolta, entry 0x0088: Data area exceeds data buffer, ignoring it.
digikam(14382)/digikam (core) Digikam::DMetadata::setImageTitles: "/media/Diskphotos/charente 2010 aout/PICT1750.JPG"  ==> Title:  QMap()
digikam(14382)/digikam (core) Digikam::DMetadata::setImageComments: "/media/Diskphotos/charente 2010 aout/PICT1750.JPG"  ==> Comment:  QMap(("x-default", CaptionValues::caption: "KONICA MINOLTA DIGITAL CAMERA", CaptionValues::author: "", CaptionValues::date: QDateTime("")  ) )
digikam(14382)/digikam (core) Digikam::DMetadata::setImagePickLabel: "/media/Diskphotos/charente 2010 aout/PICT1750.JPG"  ==> Pick Label:  0
digikam(14382)/digikam (core) Digikam::DMetadata::setImageColorLabel: "/media/Diskphotos/charente 2010 aout/PICT1750.JPG"  ==> Color Label:  0
digikam(14382)/digikam (core) Digikam::DMetadata::setImageRating: Rating value to write is out of range!
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::getXmpTagStringSeq: XMP String Seq ( Xmp.digiKam.TagsList ):  ("_Digikam_root_tag_/lieu/lestouches", "lieu/lestouches", "animal/vertebre/mammifere/ane", "lestouches", "animal", "animal/vertebre", "animal/vertebre/mammifere", "lieu2/lestouches", "_Digikam_root_tag_/_Digikam_root_tag_/animal", "_Digikam_root_tag_/_Digikam_root_tag_/animal/vertebre", "_Digikam_root_tag_/_Digikam_root_tag_/animal/vertebre/mammifere", "_Digikam_root_tag_/lieu2/lestouches", "_Digikam_root_tag_/_Digikam_root_tag_/animal/vertebre/mammifere/ane", "_Digikam_root_tag_/animal", "_Digikam_root_tag_/animal/vertebre/mammifere/ane", "_Digikam_root_tag_/animal/vertebre", "_Digikam_root_tag_/animal/vertebre/mammifere", "_Digikam_root_tag_/lieu2", "_Digikam_root_tag_/_Digikam_root_tag_/lieu/lestouches")
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::setIptcKeywords: /media/Diskphotos/charente 2010 aout/PICT1750.JPG  ==> Iptc Keywords:  animal,vertebre,mammifere,lieu2,lestouches,ane
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::save: KExiv2::metadataWritingMode 0
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::save: Will write Metadata to file "PICT1750.JPG"
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::KExiv2Priv::saveToFile: File Extension:  "jpg"  is supported for writing mode
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::KExiv2Priv::printExiv2MessageHandler: Exiv2 ( 2 ) :  Directory Minolta, entry 0x0088: Data area exceeds data buffer, ignoring it.
digikam(14382)/kio (Scheduler) KIO::SchedulerPrivate::doJob: KIO::SimpleJob(0xa8a3030)
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::KExiv2Priv::printExiv2MessageHandler: Exiv2 ( 2 ) :  Directory Minolta, entry 0x0088: Data area exceeds data buffer, ignoring it.
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::save: Metadata for file "PICT1750.JPG" written to file.
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::KExiv2Priv::printExiv2MessageHandler: Exiv2 ( 2 ) :  Directory Minolta, entry 0x0088: Data area exceeds data buffer, ignoring it.
digikam(14382)/digikam (core) Digikam::DImg::load: "/media/Diskphotos/charente 2010 aout/PICT1750.JPG"  : JPEG file identified
digikam(14382)/digikam (core) Digikam::AlbumWatch::rescanDirectory: Detected change, triggering rescan of directory "/media/Diskphotos/charente 2010 aout"
digikam(14382)/digikam (core) Digikam::AlbumWatch::rescanDirectory: Detected change, triggering rescan of directory "/media/Diskphotos/charente 2010 aout"
digikam(14382)/digikam (core) Digikam::AlbumWatch::rescanDirectory: Detected change, triggering rescan of directory "/media/Diskphotos/charente 2010 aout"
digikam(14382)/digikam (core) Digikam::AlbumWatch::rescanDirectory: Detected change, triggering rescan of directory "/media/Diskphotos/charente 2010 aout"
digikam(14382)/digikam (core) Digikam::AlbumWatch::rescanDirectory: Detected change, triggering rescan of directory "/media/Diskphotos/charente 2010 aout"
digikam(14382)/kio (KIOJob) KIO::TransferJob::slotFinished: KUrl("digikamtags:/45/46/61/163?databaseType=QMYSQL&databaseName=digikam&connectOptions=&hostName=192.168.1.2&port=3306&userName=sospcdk&password=******")
digikam(14382)/kio (Scheduler) KIO::SchedulerPrivate::jobFinished: KIO::SpecialJob(0xa8a3030) KIO::Slave(0xcdd2aa8)
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::KExiv2Priv::printExiv2MessageHandler: Exiv2 ( 2 ) :  Directory Minolta, entry 0x0088: Data area exceeds data buffer, ignoring it.
digikam(14382)/digikam (core) Digikam::DImg::load: "/media/Diskphotos/charente 2010 aout/PICT1750.JPG"  : JPEG file identified
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::KExiv2Priv::printExiv2MessageHandler: Exiv2 ( 2 ) :  Directory Minolta, entry 0x0088: Data area exceeds data buffer, ignoring it.
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::KExiv2Priv::printExiv2MessageHandler: Exiv2 ( 2 ) :  Directory Minolta, entry 0x0088: Data area exceeds data buffer, ignoring it.
digikam(14382)/digikam (core) Digikam::DImg::load: "/media/Diskphotos/charente 2010 aout/PICT1750.JPG"  : JPEG file identified
digikam(14382)/digikam (core) Digikam::DImg::load: "/media/Diskphotos/charente 2010 aout/PICT1750.JPG"  : JPEG file identified
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::getImageOrientation: Orientation => Exif.Image.Orientation =>  1
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::getImageOrientation: Orientation => Exif.Image.Orientation =>  1
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::getImageOrientation: Orientation => Exif.Image.Orientation =>  1
digikam(14382)/kio (Scheduler) KIO::SchedulerPrivate::doJob: KIO::SimpleJob(0xb758550)
digikam(14382)/kio (Scheduler) KIO::SchedulerPrivate::doJob: KIO::SimpleJob(0xa617fb8)
digikam(14382)/kio (KIOJob) KIO::TransferJob::slotFinished: KUrl("digikamtags:?databaseType=QMYSQL&databaseName=digikam&connectOptions=&hostName=192.168.1.2&port=3306&userName=sospcdk&password=******")
digikam(14382)/kio (Scheduler) KIO::SchedulerPrivate::jobFinished: KIO::SpecialJob(0xb758550) KIO::Slave(0xcdd2aa8)
digikam(14382)/kio (KIOJob) KIO::TransferJob::slotFinished: KUrl("digikamtags:?databaseType=QMYSQL&databaseName=digikam&connectOptions=&hostName=192.168.1.2&port=3306&userName=sospcdk&password=******")
digikam(14382)/kio (Scheduler) KIO::SchedulerPrivate::jobFinished: KIO::SpecialJob(0xa617fb8) KIO::Slave(0xcdd2aa8)
--------------------reread metadata -------
digikam(14382)/kio (Scheduler) KIO::SchedulerPrivate::doJob: KIO::SimpleJob(0xcbd1fc8)
digikam(14382)/kio (KIOJob) KIO::TransferJob::slotFinished: KUrl("digikamtags:/45/46/61/163?databaseType=QMYSQL&databaseName=digikam&connectOptions=&hostName=192.168.1.2&port=3306&userName=sospcdk&password=******")
digikam(14382)/kio (Scheduler) KIO::SchedulerPrivate::jobFinished: KIO::SpecialJob(0xcbd1fc8) KIO::Slave(0xcdd2aa8)
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::KExiv2Priv::printExiv2MessageHandler: Exiv2 ( 2 ) :  Directory Minolta, entry 0x0088: Data area exceeds data buffer, ignoring it.
digikam(14382)/digikam (core) Digikam::DImg::load: "/media/Diskphotos/charente 2010 aout/PICT1750.JPG"  : JPEG file identified
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::getImageDateTime: DateTime => Exif.Photo.DateTimeOriginal =>  QDateTime("Wed Aug 18 19:01:51 2010")
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::getDigitizationDateTime: DateTime (Exif digitalized):  Wed Aug 18 19:01:51 2010
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::getImageOrientation: Orientation => Exif.Image.Orientation =>  1
digikam(14382)/KEXIV2 KExiv2Iface::KExiv2::getXmpTagStringSeq: XMP String Seq ( Xmp.digiKam.TagsList ):  ("_Digikam_root_tag_/lieu/lestouches", "lieu/lestouches", "animal/vertebre/mammifere/ane", "lestouches", "animal", "animal/vertebre", "animal/vertebre/mammifere", "lieu2/lestouches", "_Digikam_root_tag_/_Digikam_root_tag_/animal", "_Digikam_root_tag_/_Digikam_root_tag_/animal/vertebre", "_Digikam_root_tag_/_Digikam_root_tag_/animal/vertebre/mammifere", "_Digikam_root_tag_/lieu2/lestouches", "_Digikam_root_tag_/_Digikam_root_tag_/animal/vertebre/mammifere/ane", "_Digikam_root_tag_/animal", "_Digikam_root_tag_/animal/vertebre/mammifere/ane", "_Digikam_root_tag_/animal/vertebre", "_Digikam_root_tag_/animal/vertebre/mammifere", "_Digikam_root_tag_/lieu2")
digikam(14382)/digikam (core) Digikam::ImageScanner::scanTags: Pick Label found :  0
digikam(14382)/digikam (core) Digikam::ImageScanner::scanTags: Assigned Pick Label Tag  :  15
digikam(14382)/digikam (core) Digikam::ImageScanner::scanTags: Color Label found :  0
digikam(14382)/digikam (core) Digikam::ImageScanner::scanTags: Assigned Color Label Tag  :  5
digikam(14382)/digikam (core) Digikam::DMetadata::getImageHistory: Loading image history  ""
digikam(14382)/kio (Scheduler) KIO::SchedulerPrivate::doJob: KIO::SimpleJob(0xa620600)
digikam(14382)/kio (Scheduler) KIO::SchedulerPrivate::doJob: KIO::SimpleJob(0xb04bf68)
digikam(14382)/kio (KIOJob) KIO::TransferJob::slotFinished: KUrl("digikamtags:?databaseType=QMYSQL&databaseName=digikam&connectOptions=&hostName=192.168.1.2&port=3306&userName=sospcdk&password=******")
digikam(14382)/kio (Scheduler) KIO::SchedulerPrivate::jobFinished: KIO::SpecialJob(0xa620600) KIO::Slave(0xcdd2aa8)
digikam(14382)/kio (KIOJob) KIO::TransferJob::slotFinished: KUrl("digikamtags:?databaseType=QMYSQL&databaseName=digikam&connectOptions=&hostName=192.168.1.2&port=3306&userName=sospcdk&password=******")
digikam(14382)/kio (Scheduler) KIO::SchedulerPrivate::jobFinished: KIO::SpecialJob(0xb04bf68) KIO::Slave(0xcdd2aa8)
digikam(14382)/kdeui (KNotification) KNotificationManager::notificationClosed: 15
--------- wrong _digikam_root_tag reappear in digikam - 

Greatings, 

Eric
Comment 38 e.longuemare 2012-11-10 15:38:10 UTC
Hello,

result of :
exiv2 -pa filename /media/Diskphotos/charente\ 2010\ aout/PICT1750.JPG 
filename: Échec de l'ouverture du fichier
Warning: Directory Minolta, entry 0x0088: Data area exceeds data buffer, ignoring it.
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Image.ProcessingSoftware                Ascii      14  digiKam-2.8.0
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Image.ImageDescription                  Ascii      30  KONICA MINOLTA DIGITAL CAMERA
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Image.Make                              Ascii      16  KONICA MINOLTA 
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Image.Model                             Ascii      10  DiMAGE Z3
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Image.Orientation                       Short       1  haut, gauche
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Image.XResolution                       Rational    1  72
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Image.YResolution                       Rational    1  72
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Image.ResolutionUnit                    Short       1  Pouce
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Image.Software                          Ascii      16  DiMAGE Z3 v1.03
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Image.DateTime                          Ascii      20  2010:08:18 19:01:51
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Image.YCbCrPositioning                  Short       1  Centré
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Image.ExifTag                           Long        1  410
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.ExposureTime                      Rational    1  1/125 s
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.FNumber                           Rational    1  F4
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.ExposureProgram                   Short       1  Programme Action
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.ISOSpeedRatings                   Short       1  50
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.ExifVersion                       Undefined   4  2.20
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.DateTimeOriginal                  Ascii      20  2010:08:18 19:01:51
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.DateTimeDigitized                 Ascii      20  2010:08:18 19:01:51
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.ComponentsConfiguration           Undefined   4  YCbCr
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.BrightnessValue                   SRational   1  7.1
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.ExposureBiasValue                 SRational   1  0 EV
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.MaxApertureValue                  Rational    1  F4
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.MeteringMode                      Short       1  Multi-segments
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.LightSource                       Short       1  Inconnu
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.Flash                             Short       1  Non, mode auto
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.FocalLength                       Rational    1  22.3 mm
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.SubjectArea                       Short       4  1136 852 280 280
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.MakerNote                         Undefined 33216  (Valeur binaire supprimée)
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.MakerNote.Offset                        Long        1  920
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.MakerNote.ByteOrder                     Ascii       3  MM
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Minolta.Version                         Undefined   4  77 76 84 48
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Minolta.ImageStabilizationData          Undefined 4042  (Valeur binaire supprimée)
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Minolta.WBInfoA100                      Undefined 4384  (Valeur binaire supprimée)
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Minolta.CompressedImageSize             Long        1  1634269
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Minolta.ThumbnailOffset                 Long        1  34136
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Minolta.ThumbnailLength                 Long        1  57785
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Minolta.SceneMode                       Long        1  Sports
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Minolta.ColorMode                       Long        1  Naturel
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Minolta.Quality                         Long        1  Fin
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Minolta.FlashExposureComp               SRational   1  0 EV
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Minolta.Teleconverter                   Long        1  Aucun
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Minolta.ImageStabilization              Long        0  
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.UserComment                       Undefined  37  KONICA MINOLTA DIGITAL CAMERA
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.FlashpixVersion                   Undefined   4  1.00
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.ColorSpace                        Short       1  sRGB
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.PixelXDimension                   Long        1  2272
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.PixelYDimension                   Long        1  1704
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.InteroperabilityTag               Long        1  34182
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Iop.InteroperabilityIndex               Ascii       4  R98
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Iop.InteroperabilityVersion             Undefined   4  1.00
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.CustomRendered                    Short       1  Processus normal
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.ExposureMode                      Short       1  Automatique
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.WhiteBalance                      Short       1  Automatique
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.DigitalZoomRatio                  Rational    1  0.0
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.FocalLengthIn35mmFilm             Short       1  137.0 mm
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.SceneCaptureType                  Short       1  Standard
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.GainControl                       Short       1  Aucun
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.Contrast                          Short       1  Normal
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.Saturation                        Short       1  Normal
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.Sharpness                         Short       1  Normal
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Photo.SubjectDistanceRange              Short       1  Plan large
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Image.PrintImageMatching                Undefined 118  80 114 105 110 116 73 77 0 48 50 53 48 0 0 0 5 0 1 0 22 0 22 0 2 1 0 0 0 0 3 0 0 0 46 1 0 1 0 0 0 1 1 0 0 0 0 0 0 17 9 0 0 39 16 0 0 15 11 0 0 39 16 0 0 5 151 0 0 39 16 0 0 8 176 0 0 39 16 0 0 28 1 0 0 39 16 0 0 2 94 0 0 39 16 0 0 0 139 0 0 39 16 0 0 3 203 0 0 39 16 0 0 27 229 0 0 39 16
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Thumbnail.Compression                   Short       1  JPEG (ancienne version)
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Thumbnail.Orientation                   Short       1  haut, gauche
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Thumbnail.XResolution                   Rational    1  72
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Thumbnail.YResolution                   Rational    1  72
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Thumbnail.ResolutionUnit                Short       1  Pouce
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Thumbnail.JPEGInterchangeFormat         Long        1  34330
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Thumbnail.JPEGInterchangeFormatLength   Long        1  3723
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Exif.Thumbnail.YCbCrPositioning              Short       1  Centré
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Iptc.Application2.Program                    String      7  digiKam
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Iptc.Application2.ProgramVersion             String      5  2.8.0
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Iptc.Application2.DateCreated                Date        8  2010-08-18
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Iptc.Application2.TimeCreated                Time       11  19:01:51+00:00
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Iptc.Application2.Keywords                   String      0  
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Iptc.Application2.Caption                    String     29  KONICA MINOLTA DIGITAL CAMERA
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Iptc.Application2.Keywords                   String      6  animal
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Iptc.Application2.Keywords                   String      8  vertebre
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Iptc.Application2.Keywords                   String      9  mammifere
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Iptc.Application2.Keywords                   String      5  lieu2
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Iptc.Application2.Keywords                   String     10  lestouches
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Iptc.Application2.Keywords                   String      3  ane
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.tiff.Software                            XmpText    13  digiKam-2.8.0
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.tiff.DateTime                            XmpText    19  2010-08-18T19:01:51
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.tiff.Orientation                         XmpText     1  haut, gauche
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.tiff.YCbCrPositioning                    XmpText     1  Centré
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.tiff.XResolution                         XmpText     4  72
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.tiff.YResolution                         XmpText     4  72
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.tiff.ResolutionUnit                      XmpText     1  Pouce
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.tiff.Make                                XmpText    15  KONICA MINOLTA 
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.tiff.Model                               XmpText     9  DiMAGE Z3
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.tiff.ImageDescription                    LangAlt     1  lang="x-default" KONICA MINOLTA DIGITAL CAMERA
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.xmp.CreatorTool                          XmpText    13  digiKam-2.5.0
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.xmp.CreateDate                           XmpText    19  2010-08-18T19:01:51
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.xmp.MetadataDate                         XmpText    19  2010-08-18T19:01:51
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.xmp.ModifyDate                           XmpText    19  2010-08-18T19:01:51
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.digiKam.PickLabel                        XmpText     1  0
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.digiKam.ColorLabel                       XmpText     1  0
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.digiKam.TagsList                         XmpSeq     18  _Digikam_root_tag_/lieu/lestouches, lieu/lestouches, animal/vertebre/mammifere/ane, lestouches, animal, animal/vertebre, animal/vertebre/mammifere, lieu2/lestouches, _Digikam_root_tag_/_Digikam_root_tag_/animal, _Digikam_root_tag_/_Digikam_root_tag_/animal/vertebre, _Digikam_root_tag_/_Digikam_root_tag_/animal/vertebre/mammifere, _Digikam_root_tag_/lieu2/lestouches, _Digikam_root_tag_/_Digikam_root_tag_/animal/vertebre/mammifere/ane, _Digikam_root_tag_/animal, _Digikam_root_tag_/animal/vertebre/mammifere/ane, _Digikam_root_tag_/animal/vertebre, _Digikam_root_tag_/animal/vertebre/mammifere, _Digikam_root_tag_/lieu2
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.digiKam.CaptionsAuthorNames              LangAlt     1  lang="x-default" 
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.digiKam.CaptionsDateTimeStamps           LangAlt     1  lang="x-default" 
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.DateTimeOriginal                    XmpText    19  2010:08:18 19:01:51
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.ExifVersion                         XmpText     4  2.20
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.FlashpixVersion                     XmpText     4  1.00
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.ColorSpace                          XmpText     1  sRGB
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.PixelXDimension                     XmpText     4  2272
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.PixelYDimension                     XmpText     4  1704
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.DateTimeDigitized                   XmpText    19  2010-08-18T19:01:51
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.ExposureTime                        XmpText     5  1/125
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.FNumber                             XmpText     5  F4
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.ExposureProgram                     XmpText     1  Programme Action
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.BrightnessValue                     XmpText     5  7.1
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.ExposureBiasValue                   XmpText     4  0 EV
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.MaxApertureValue                    XmpText     7  400/100
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.MeteringMode                        XmpText     1  Multi-segments
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.LightSource                         XmpText     1  Inconnu
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.FocalLength                         XmpText    13  22.3 mm
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.CustomRendered                      XmpText     1  Processus normal
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.ExposureMode                        XmpText     1  Automatique
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.WhiteBalance                        XmpText     1  Automatique
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.DigitalZoomRatio                    XmpText     4  0/10
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.FocalLengthIn35mmFilm               XmpText     3  137
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.SceneCaptureType                    XmpText     1  Standard
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.GainControl                         XmpText     1  Aucun
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.Contrast                            XmpText     1  Normal
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.Saturation                          XmpText     1  Normal
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.Sharpness                           XmpText     1  Normal
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.SubjectDistanceRange                XmpText     1  Plan large
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.ComponentsConfiguration             XmpSeq      4  YCbCr
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.ISOSpeedRatings                     XmpSeq      1  50
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.Flash                               XmpText     0  type="Struct"
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.Flash/exif:Fired                    XmpText     5  False
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.Flash/exif:Return                   XmpText     1  0
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.Flash/exif:Mode                     XmpText     1  3
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.Flash/exif:Function                 XmpText     5  False
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.Flash/exif:RedEyeMode               XmpText     5  False
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.SubjectArea                         XmpSeq      1  1136 852 280 280
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.exif.UserComment                         LangAlt     1  lang="x-default" KONICA MINOLTA DIGITAL CAMERA
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.photoshop.DateCreated                    XmpText    19  2010-08-18T19:01:51
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.dc.subject                               XmpBag      6  animal, vertebre, mammifere, lieu2, lestouches, ane
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.dc.description                           LangAlt     1  lang="x-default" KONICA MINOLTA DIGITAL CAMERA
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.MicrosoftPhoto.LastKeywordXMP            XmpSeq     18  _Digikam_root_tag_/lieu/lestouches, lieu/lestouches, animal/vertebre/mammifere/ane, lestouches, animal, animal/vertebre, animal/vertebre/mammifere, lieu2/lestouches, _Digikam_root_tag_/_Digikam_root_tag_/animal, _Digikam_root_tag_/_Digikam_root_tag_/animal/vertebre, _Digikam_root_tag_/_Digikam_root_tag_/animal/vertebre/mammifere, _Digikam_root_tag_/lieu2/lestouches, _Digikam_root_tag_/_Digikam_root_tag_/animal/vertebre/mammifere/ane, _Digikam_root_tag_/animal, _Digikam_root_tag_/animal/vertebre/mammifere/ane, _Digikam_root_tag_/animal/vertebre, _Digikam_root_tag_/animal/vertebre/mammifere, _Digikam_root_tag_/lieu2
/media/Diskphotos/charente 2010 aout/PICT1750.JPG  Xmp.lr.hierarchicalSubject                   XmpBag     18  _Digikam_root_tag_|lieu|lestouches, lieu|lestouches, animal|vertebre|mammifere|ane, lestouches, animal, animal|vertebre, animal|vertebre|mammifere, lieu2|lestouches, _Digikam_root_tag_|_Digikam_root_tag_|animal, _Digikam_root_tag_|_Digikam_root_tag_|animal|vertebre, _Digikam_root_tag_|_Digikam_root_tag_|animal|vertebre|mammifere, _Digikam_root_tag_|lieu2|lestouches, _Digikam_root_tag_|_Digikam_root_tag_|animal|vertebre|mammifere|ane, _Digikam_root_tag_|animal, _Digikam_root_tag_|animal|vertebre|mammifere|ane, _Digikam_root_tag_|animal|vertebre, _Digikam_root_tag_|animal|vertebre|mammifere, _Digikam_root_tag_|lieu2

Greatings,

Eric
Comment 39 e.longuemare 2012-11-10 19:59:20 UTC
Hello,

In XMP.digiKam.TagsList they are some _Digikam_root_tag, I think this is not a normal thing ?
--
 Xmp.digiKam.TagsList XmpSeq 18 _Digikam_root_tag_/lieu/lestouches, lieu/lestouches, animal/vertebre/mammifere/ane, lestouches, animal, animal/vertebre, animal/vertebre/mammifere, lieu2/lestouches, _Digikam_root_tag_/_Digikam_root_tag_/animal, _Digikam_root_tag_/_Digikam_root_tag_/animal/vertebre, _Digikam_root_tag_/_Digikam_root_tag_/animal/vertebre/mammifere, _Digikam_root_tag_/lieu2/lestouches, _Digikam_root_tag_/_Digikam_root_tag_/animal/vertebre/mammifere/ane, _Digikam_root_tag_/animal, _Digikam_root_tag_/animal/vertebre/mammifere/ane, _Digikam_root_tag_/animal/vertebre, _Digikam_root_tag_/animal/vertebre/mammifere, _Digikam_root_tag_/lieu2
--
Is it or not ?

Greatings,

Eric
Comment 40 caulier.gilles 2012-11-10 21:54:07 UTC
yes, it's abnormal, but not reproducible here with sqlite DB

Gilles Caulier
Comment 41 e.longuemare 2012-11-10 23:44:58 UTC
Thank you,

I had this link for those (and me) who want to understand how digikams tags are created and modified :
https://bugs.kde.org/show_bug.cgi?id=268688

Greatings,

Eric
Comment 42 e.longuemare 2012-11-11 10:18:33 UTC
Hello,

1 - backup all pictures
1.5 - closed Digikam
2 - I have removed all metadata from pictures with : exiftool -xmp:LastKeywordXMP= -xmp:TagsList= -xmp:hierarchicalSubject= *.jpg
3 - I have removed all digikam and thumbnail databases tables 
4 - restart digikam (which create new tables and ask to add a new collection) - I reset as it was before suppress tables.
5 - this is what I get now, no more multiple _Digikam_root_tag :

Query Output:
> SELECT * FROM digikam.Tags ORDER BY lft

+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
| id      | pid      | name      | icon      | iconkde      | lft      | rgt      |
+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
| 0       | -1       | _Digikam_root_tag_ | 0         |              | 1        | 430      |
| 209     | 0        | matthis   | 0         |              | 2        | 3        |
| 208     | 0        | ragondin  | 0         |              | 4        | 5        |
| 205     | 0        | paon      | 0         |              | 6        | 7        |
| 204     | 0        | brochet   | 0         |              | 8        | 9        |
| 203     | 0        | buccin    | 0         |              | 10       | 11       |
| 202     | 0        | littorine | 0         |              | 12       | 13       |
| 201     | 0        | patelle   | 0         |              | 14       | 15       |
| 200     | 0        | huitre    | 0         |              | 16       | 17       |
| 199     | 0        | nereis    | 0         |              | 18       | 19       |
| 196     | 0        | chassiron | 0         |              | 20       | 21       |
| 195     | 0        | crepidule | 0         |              | 22       | 23       |
| 193     | 0        | marbré   | 0         |              | 24       | 25       |
| 191     | 0        | hassan    | 0         |              | 26       | 27       |
| 190     | 0        | mathias   | 0         |              | 28       | 29       |
| 189     | 0        | phil      | 0         |              | 30       | 31       |
| 188     | 0        | dakhla    | 0         |              | 32       | 33       |
| 186     | 0        | merlan    | 0         |              | 34       | 35       |
| 185     | 0        | congre    | 0         |              | 36       | 37       |
| 182     | 0        | flet      | 0         |              | 38       | 39       |
| 181     | 0        | herisson  | 0         |              | 40       | 41       |
| 180     | 0        | Jetee du dyck | 0         |              | 42       | 43       |
| 178     | 0        | grande castagnole | 0         |              | 44       | 45       |
| 177     | 0        | tournehem | 0         |              | 46       | 47       |
| 176     | 0        | cerf-biche | 0         |              | 48       | 49       |
| 175     | 0        | sitelle   | 0         |              | 50       | 51       |
| 174     | 0        | Minerve   | 0         |              | 52       | 53       |
| 173     | 0        | Sigean    | 0         |              | 54       | 55       |
| 172     | 0        | Santiago  | 0         |              | 56       | 57       |
| 171     | 0        | San Francisco | 0         |              | 58       | 59       |
| 170     | 0        | Torreira  | 0         |              | 60       | 61       |
| 165     | 0        | girelle   | 0         |              | 62       | 63       |
| 163     | 0        | sar       | 0         |              | 64       | 65       |
| 162     | 0        | telline   | 0         |              | 66       | 67       |
| 160     | 0        | mulet     | 0         |              | 68       | 69       |
| 159     | 0        | florian   | 0         |              | 70       | 71       |
| 157     | 0        | praire    | 0         |              | 72       | 73       |
| 155     | 0        | ver coréen | 0         |              | 74       | 75       |
| 154     | 0        | platja de la marquesa | 0         |              | 76       | 77       |
| 153     | 0        | sardine   | 0         |              | 78       | 79       |
| 151     | 0        | chevreuil | 0         |              | 80       | 81       |
| 150     | 0        | crecy     | 0         |              | 82       | 83       |
| 149     | 0        | creche    | 0         |              | 84       | 85       |
| 148     | 0        | jenny     | 0         |              | 86       | 87       |
| 147     | 0        | cranpoulet | 0         |              | 88       | 89       |
| 146     | 0        | cranauxoeufs | 0         |              | 90       | 91       |
| 145     | 0        | couteau   | 0         |              | 92       | 93       |
| 144     | 0        | coque     | 0         |              | 94       | 95       |
| 142     | 0        | perceneige | 0         |              | 96       | 97       |
| 141     | 0        | coccinelle | 0         |              | 98       | 99       |
| 139     | 0        | crabe     | 0         |              | 100      | 101      |
| 138     | 0        | clipon    | 0         |              | 102      | 103      |
| 137     | 0        | berlou    | 0         |              | 104      | 105      |
| 136     | 0        | oxanne    | 0         |              | 106      | 107      |
| 135     | 0        | sete      | 0         |              | 108      | 109      |
| 134     | 0        | chat      | 0         |              | 110      | 111      |
| 133     | 0        | coquelicot | 0         |              | 112      | 113      |
| 132     | 0        | vigne     | 0         |              | 114      | 115      |
| 131     | 0        | cahors    | 0         |              | 116      | 117      |
| 130     | 0        | vendee    | 0         |              | 118      | 119      |
| 129     | 0        | pointe de la coubre | 0         |              | 120      | 121      |
| 128     | 0        | vert bois | 0         |              | 122      | 123      |
| 127     | 0        | pointedegatseau | 0         |              | 124      | 125      |
| 126     | 0        | grenouille | 0         |              | 126      | 127      |
| 125     | 0        | maigre    | 0         |              | 128      | 129      |
| 124     | 0        | insecte   | 0         |              | 130      | 131      |
| 123     | 0        | crapule   | 0         |              | 132      | 133      |
| 122     | 0        | aigrette  | 0         |              | 134      | 135      |
| 121     | 0        | rapace    | 0         |              | 136      | 137      |
| 120     | 0        | vanneau   | 0         |              | 138      | 139      |
| 119     | 0        | fleur     | 0         |              | 140      | 141      |
| 118     | 0        | ane       | 0         |              | 142      | 143      |
| 117     | 0        | lieu2     | 0         |              | 144      | 145      |
| 116     | 0        | cheval    | 0         |              | 146      | 147      |
| 115     | 0        | heron     | 0         |              | 148      | 149      |
| 114     | 0        | vache     | 0         |              | 150      | 151      |
| 113     | 0        | hirondelle | 0         |              | 152      | 153      |
| 112     | 0        | vincent   | 0         |              | 154      | 155      |
| 111     | 0        | cigogne   | 0         |              | 156      | 157      |
| 110     | 0        | embellie  | 0         |              | 158      | 159      |
| 109     | 0        | lestouches | 0         |              | 160      | 161      |
| 108     | 0        | pointeespagnole | 0         |              | 162      | 163      |
| 106     | 0        | etoile de mer | 0         |              | 164      | 165      |
| 104     | 0        | lieu      | 0         |              | 166      | 183      |
| 206     | 104      | bretignolles la sauzaie | 0         |              | 167      | 168      |
| 198     | 104      | vert bois | 0         |              | 169      | 170      |
| 183     | 104      | creche    | 0         |              | 171      | 172      |
| 167     | 104      | dyck      | 0         |              | 173      | 174      |
| 158     | 104      | riumar    | 0         |              | 175      | 176      |
| 156     | 104      | platja de la marquesa | 0         |              | 177      | 178      |
| 107     | 104      | saumonard | 0         |              | 179      | 180      |
| 105     | 104      | ronce les bains | 0         |              | 181      | 182      |
| 103     | 0        | ronce les bains | 0         |              | 184      | 185      |
| 102     | 0        | tente     | 0         |              | 186      | 187      |
| 99      | 0        | fort boyard | 0         |              | 188      | 189      |
| 97      | 0        | trombine  | 0         |              | 190      | 201      |
| 192     | 97       | hassan    | 0         |              | 191      | 192      |
| 169     | 97       | marco     | 0         |              | 193      | 194      |
| 168     | 97       | julien    | 0         |              | 195      | 196      |
| 100     | 97       | gribouille | 0         |              | 197      | 198      |
| 98      | 97       | xavier    | 0         |              | 199      | 200      |
| 95      | 0        | tacaud    | 0         |              | 202      | 203      |
| 94      | 0        | xavier    | 0         |              | 204      | 205      |
| 93      | 0        | saumonard | 0         |              | 206      | 207      |
| 92      | 0        | magalie   | 0         |              | 208      | 209      |
| 91      | 0        | cessenonorb | 0         |              | 210      | 211      |
| 90      | 0        | francoise | 0         |              | 212      | 213      |
| 89      | 0        | andre     | 0         |              | 214      | 215      |
| 88      | 0        | dauphinbleu | 0         |              | 216      | 217      |
| 87      | 0        | carnot    | 0         |              | 218      | 219      |
| 86      | 0        | capgrisnez | 0         |              | 220      | 221      |
| 85      | 0        | ruytingen | 0         |              | 222      | 223      |
| 84      | 0        | plomb grappin | 0         |              | 224      | 225      |
| 82      | 0        | cabillaud | 0         |              | 226      | 227      |
| 81      | 0        | turbot    | 0         |              | 228      | 229      |
| 80      | 0        | bretignolles la sauzaie | 0         |              | 230      | 231      |
| 79      | 0        | maquereau | 0         |              | 232      | 233      |
| 78      | 0        | lancon    | 0         |              | 234      | 235      |
| 77      | 0        | anemone   | 0         |              | 236      | 237      |
| 76      | 0        | cnidaire  | 0         |              | 238      | 239      |
| 75      | 0        | emissole  | 0         |              | 240      | 241      |
| 74      | 0        | petite roussette | 0         |              | 242      | 243      |
| 73      | 0        | vieille   | 0         |              | 244      | 245      |
| 72      | 0        | araignéedemer | 0         |              | 246      | 247      |
| 71      | 0        | araigneedemer | 0         |              | 248      | 249      |
| 70      | 0        | raie      | 0         |              | 250      | 251      |
| 69      | 0        | moule     | 0         |              | 252      | 253      |
| 68      | 0        | mollusque | 0         |              | 254      | 255      |
| 67      | 0        | Chevret   | 0         |              | 256      | 257      |
| 66      | 0        | sole      | 0         |              | 258      | 259      |
| 65      | 0        | rondins gravelines | 0         |              | 260      | 261      |
| 64      | 0        | dunkerque | 0         |              | 262      | 263      |
| 63      | 0        | arenicole | 0         |              | 264      | 265      |
| 62      | 0        | ver       | 0         |              | 266      | 267      |
| 61      | 0        | sanglier  | 0         |              | 268      | 269      |
| 60      | 0        | mormal    | 0         |              | 270      | 271      |
| 59      | 0        | annoeullin | 0         |              | 272      | 273      |
| 58      | 0        | whitney   | 0         |              | 274      | 275      |
| 57      | 0        | kenzo     | 0         |              | 276      | 277      |
| 56      | 0        | dorade    | 0         |              | 278      | 279      |
| 55      | 0        | Vendres   | 0         |              | 280      | 281      |
| 54      | 0        | viviane   | 0         |              | 282      | 283      |
| 53      | 0        | joel      | 0         |              | 284      | 285      |
| 52      | 0        | simba     | 0         |              | 286      | 287      |
| 51      | 0        | cazedarnes | 0         |              | 288      | 289      |
| 50      | 0        | allan     | 0         |              | 290      | 291      |
| 49      | 0        | gorgedheric | 0         |              | 292      | 293      |
| 48      | 0        | anais     | 0         |              | 294      | 295      |
| 47      | 0        | faisan    | 0         |              | 296      | 297      |
| 46      | 0        | chloe     | 0         |              | 298      | 299      |
| 45      | 0        | amsterdam | 0         |              | 300      | 301      |
| 44      | 0        | mouton    | 0         |              | 302      | 303      |
| 43      | 0        | animal2   | 0         |              | 304      | 305      |
| 42      | 0        | canard    | 0         |              | 306      | 307      |
| 41      | 0        | cygne     | 0         |              | 308      | 309      |
| 40      | 0        | salsperwick | 0         |              | 310      | 311      |
| 39      | 0        | gonzague  | 0         |              | 312      | 313      |
| 38      | 0        | christelle | 0         |              | 314      | 315      |
| 37      | 0        | oye plage | 0         |              | 316      | 317      |
| 36      | 0        | charlotte | 0         |              | 318      | 319      |
| 34      | 0        | anguille  | 0         |              | 320      | 321      |
| 32      | 0        | bar       | 0         |              | 322      | 323      |
| 31      | 0        | poisson   | 0         |              | 324      | 355      |
| 207     | 31       | turbot    | 0         |              | 325      | 326      |
| 197     | 31       | congre    | 0         |              | 327      | 328      |
| 194     | 31       | marbré   | 0         |              | 329      | 330      |
| 187     | 31       | merlan    | 0         |              | 331      | 332      |
| 184     | 31       | flet      | 0         |              | 333      | 334      |
| 179     | 31       | grande castagnole | 0         |              | 335      | 336      |
| 166     | 31       | girelle   | 0         |              | 337      | 338      |
| 164     | 31       | sar       | 0         |              | 339      | 340      |
| 161     | 31       | mulet     | 0         |              | 341      | 342      |
| 152     | 31       | maigre    | 0         |              | 343      | 344      |
| 101     | 31       | dorade    | 0         |              | 345      | 346      |
| 96      | 31       | tacaud    | 0         |              | 347      | 348      |
| 83      | 31       | cabillaud | 0         |              | 349      | 350      |
| 35      | 31       | anguille  | 0         |              | 351      | 352      |
| 33      | 31       | bar       | 0         |              | 353      | 354      |
| 30      | 0        | marco     | 0         |              | 356      | 357      |
| 29      | 0        | volvo-240 | 0         |              | 358      | 359      |
| 28      | 0        | callianasse | 0         |              | 360      | 361      |
| 27      | 0        | crustace  | 0         |              | 362      | 365      |
| 140     | 27       | crabe     | 0         |              | 363      | 364      |
| 26      | 0        | invertebre | 0         |              | 366      | 367      |
| 25      | 0        | diguebreak | 0         |              | 368      | 369      |
| 24      | 0        | goeland   | 0         |              | 370      | 371      |
| 23      | 0        | oiseau    | 0         |              | 372      | 373      |
| 22      | 0        | gribouille | 0         |              | 374      | 375      |
| 21      | 0        | eric      | 0         |              | 376      | 377      |
| 20      | 0        | mustelide | 0         |              | 378      | 379      |
| 19      | 0        | mammifere | 0         |              | 380      | 381      |
| 18      | 0        | vertebre  | 0         |              | 382      | 383      |
| 17      | 0        | animal    | 0         |              | 384      | 385      |
| 2       | 0        | _Digikam_Internal_Tags_ | 0         |              | 386      | 427      |
| 214     | 2        | Version Always Visible | 0         |              | 387      | 388      |
| 213     | 2        | Intermediate Version | 0         |              | 389      | 390      |
| 212     | 2        | Current Version | 0         |              | 391      | 392      |
| 211     | 2        | Original Version | 0         |              | 393      | 394      |
| 210     | 2        | Need Tagging History Graph | 0         |              | 395      | 396      |
| 143     | 2        | Need Resolving History | 0         |              | 397      | 398      |
| 16      | 2        | Pick Label Accepted | 0         |              | 399      | 400      |
| 15      | 2        | Pick Label Pending | 0         |              | 401      | 402      |
| 14      | 2        | Pick Label Rejected | 0         |              | 403      | 404      |
| 13      | 2        | Pick Label None | 0         |              | 405      | 406      |
| 12      | 2        | Color Label White | 0         |              | 407      | 408      |
| 11      | 2        | Color Label Black | 0         |              | 409      | 410      |
| 10      | 2        | Color Label Gray | 0         |              | 411      | 412      |
| 9       | 2        | Color Label Magenta | 0         |              | 413      | 414      |
| 8       | 2        | Color Label Blue | 0         |              | 415      | 416      |
| 7       | 2        | Color Label Green | 0         |              | 417      | 418      |
| 6       | 2        | Color Label Yellow | 0         |              | 419      | 420      |
| 5       | 2        | Color Label Orange | 0         |              | 421      | 422      |
| 4       | 2        | Color Label Red | 0         |              | 423      | 424      |
| 3       | 2        | Color Label None | 0         |              | 425      | 426      |
| 1       | 0        | capblancnez | 0         |              | 428      | 429      |
| NULL    | NULL     | NULL      | NULL      | NULL         | NULL     | NULL     |
+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
216 rows

I will try now to reorganise as near all the tag hierarchy have been lost.

And look if I got multiple _Digikam_root_tag back.

Greatings,

Eric
Comment 43 e.longuemare 2012-11-11 11:38:05 UTC
Hello,

I remove tag animal (uncheck on the tags left pannel), then check animal2, then apply.
This is what I got now in a picture which was having tag animal, suppressef, and was tagging with animal2 :
Xmp.digiKam.TagsList  XmpSeq      5  animal, vertebre, oiseau, faisan, _Digikam_root_tag_/animal2

Other tags are : 
Xmp.MicrosoftPhoto.LastKeywordXMP XmpSeq      5  animal, vertebre, oiseau, faisan, _Digikam_root_tag_/animal2
Xmp.lr.hierarchicalSubject XmpBag 5  animal, vertebre, oiseau, faisan, _Digikam_root_tag_|animal2

No change in table digikam.Tags
animal and animal2 still there with same id, lft and rgt.

Greatings,

Eric
Comment 44 e.longuemare 2012-11-11 11:50:12 UTC
Hello,

reread from digikam, metadata from the picture  (/more in tags left panel, then read ...).
- No change in table digikam.tags
- No change in the picture tags (same as precedent post)

But,

 I have retag multiple images with same action (remove animal, check animal2 and apply).
For the one I have reread, animal is check again, no tag _Digikam_root_tag appear in left tags and right tags panel, but with a right click on the image I should see :

- remove a tag - _Digikam_root_tag / animal

Other tags are right.

Greatings,

Eric
Comment 45 e.longuemare 2012-11-11 12:17:40 UTC
The tricky thing is that in image tags I have /_Digikam_root_tag_/animal2.

And in supress tag menu (right click on picture) I have /_Digikam_root_tag_/animal.

Greatings,

Eric
Comment 46 e.longuemare 2012-11-11 12:56:32 UTC
Table tags for tag animal and animal2 :

	id 	pid 	name 	icon 	iconkde 	lft 	rgt
	17 	0 	animal 	0 	null      384 	385
	43 	0 	animal2 	0 null  	304 	305

Query Output for animal:
> SELECT * FROM digikam.Tags WHERE lft BETWEEN 384 AND 385 ORDER BY lft ASC

+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
| id      | pid      | name      | icon      | iconkde      | lft      | rgt      |
+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
| 17      | 0        | animal    | 0         |              | 384      | 385      |
| NULL    | NULL     | NULL      | NULL      | NULL         | NULL     | NULL     |
+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
2 rows
Comment 47 e.longuemare 2012-11-11 12:58:28 UTC
Query Output for animal2:
> SELECT * FROM digikam.Tags WHERE lft BETWEEN 304 AND 305 ORDER BY lft ASC

+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
| id      | pid      | name      | icon      | iconkde      | lft      | rgt      |
+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
| 43      | 0        | animal2   | 0         |              | 304      | 305      |
| NULL    | NULL     | NULL      | NULL      | NULL         | NULL     | NULL     |
+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
2 rows
Comment 48 e.longuemare 2012-11-11 13:02:03 UTC
Get parent for animal :
Query Output:
> SELECT * FROM digikam.Tags WHERE lft < 384 AND rgt > 385 ORDER BY lft ASC

+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
| id      | pid      | name      | icon      | iconkde      | lft      | rgt      |
+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
| 0       | -1       | _Digikam_root_tag_ | 0         |              | 1        | 430      |
| NULL    | NULL     | NULL      | NULL      | NULL         | NULL     | NULL     |
+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
2 rows
Comment 49 e.longuemare 2012-11-11 13:03:47 UTC
Get parent for animal2

Query Output:
> SELECT * FROM digikam.Tags WHERE lft < 304 AND rgt > 305 ORDER BY lft ASC

+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
| id      | pid      | name      | icon      | iconkde      | lft      | rgt      |
+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
| 0       | -1       | _Digikam_root_tag_ | 0         |              | 1        | 430      |
| NULL    | NULL     | NULL      | NULL      | NULL         | NULL     | NULL     |
+ ------- + -------- + --------- + --------- + ------------ + -------- + -------- +
2 rows
Comment 50 e.longuemare 2012-11-11 13:17:56 UTC
Another link that explain what are lft and rgt values :

http://www.sitepoint.com/hierarchical-data-database-2/
Comment 51 e.longuemare 2012-11-11 17:30:14 UTC
Hello,

Don't modify anything since removed tag animal and write tag animal2

The medadatas of the file  are:
----
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Image.ProcessingSoftware                Ascii      14  digiKam-2.8.0
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Image.Make                              Ascii      18  Minolta Co., Ltd.
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Image.Model                             Ascii      10  DiMAGE Z1
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Image.Orientation                       Short       1  haut, gauche
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Image.XResolution                       Rational    1  72
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Image.YResolution                       Rational    1  72
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Image.ResolutionUnit                    Short       1  Pouce
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Image.Software                          Ascii      11  GIMP 2.4.1
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Image.DateTime                          Ascii      20  2008:05:10 19:27:13
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Image.YCbCrPositioning                  Short       1  Co-sited
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Image.ExifTag                           Long        1  288
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.ExposureTime                      Rational    1  1/400 s
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.FNumber                           Rational    1  F3.5
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.ExposureProgram                   Short       1  Automatique
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.ISOSpeedRatings                   Short       1  80
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.ExifVersion                       Undefined   4  2.20
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.DateTimeOriginal                  Ascii      20  2008:05:10 19:27:13
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.DateTimeDigitized                 Ascii      20  2008:05:10 19:27:13
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.ComponentsConfiguration           Undefined   4  YCbCr
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.CompressedBitsPerPixel            Rational    1  4
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.BrightnessValue                   SRational   1  6.2
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.ExposureBiasValue                 SRational   1  0 EV
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.MaxApertureValue                  Rational    1  F3.5
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.MeteringMode                      Short       1  Multi-segments
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.LightSource                       Short       1  Inconnu
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.Flash                             Short       1  Non, inhibé
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.FocalLength                       Rational    1  58.0 mm
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.SubjectArea                       Short       4  1024 768 44 29
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.MakerNote                         Undefined 760  (Valeur binaire supprimée)
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.MakerNote.Offset                        Long        1  830
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.MakerNote.ByteOrder                     Ascii       3  II
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Minolta.Version                         Undefined   4  77 76 89 48
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Minolta.ThumbnailOffset                 Long        1  1590
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Minolta.ThumbnailLength                 Long        1  36340
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Minolta.SceneMode                       Long        1  Ensoleillé
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Minolta.ColorMode                       Long        1  Couleur naturelle
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Minolta.Quality                         Long        1  Fin
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Minolta.FlashExposureComp               SRational   1  (0/0)
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Minolta.Teleconverter                   Long        1  Aucun
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Minolta.CameraSettingsZ1                Undefined 614  (Valeur binaire supprimée)
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.FlashpixVersion                   Undefined   4  1.00
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.ColorSpace                        Short       1  sRGB
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.PixelXDimension                   Long        1  2048
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.PixelYDimension                   Long        1  1536
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.InteroperabilityTag               Long        1  1598
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Iop.InteroperabilityIndex               Ascii       4  R98
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Iop.InteroperabilityVersion             Undefined   4  1.00
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.FileSource                        Undefined   1  Appareil photo numérique
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.SceneType                         Undefined   1  Photographié directement
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.CustomRendered                    Short       1  Processus personnel
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.ExposureMode                      Short       1  Automatique
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.WhiteBalance                      Short       1  Automatique
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.DigitalZoomRatio                  Rational    1  0.0
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.FocalLengthIn35mmFilm             Short       1  380.0 mm
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.SceneCaptureType                  Short       1  Standard
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.GainControl                       Short       1  Aucun
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.Contrast                          Short       1  Normal
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.Saturation                        Short       1  Normal
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.Sharpness                         Short       1  Normal
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Photo.SubjectDistanceRange              Short       1  Plan large
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Image.PrintImageMatching                Undefined  40  80 114 105 110 116 73 77 0 48 50 53 48 0 0 4 0 1 0 22 0 22 0 2 0 0 0 0 1 0 1 0 0 0 1 1 1 0 0 0 0
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Thumbnail.Compression                   Short       1  JPEG (ancienne version)
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Thumbnail.XResolution                   Rational    1  72
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Thumbnail.YResolution                   Rational    1  72
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Thumbnail.ResolutionUnit                Short       1  Pouce
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Thumbnail.JPEGInterchangeFormat         Long        1  1722
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Exif.Thumbnail.JPEGInterchangeFormatLength   Long        1  9886
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Iptc.Application2.Program                    String      7  digiKam
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Iptc.Application2.ProgramVersion             String      5  2.8.0
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Iptc.Application2.DateCreated                Date        8  2008-05-10
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Iptc.Application2.TimeCreated                Time       11  19:27:13+00:00
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Iptc.Application2.Keywords                   String      6  faisan
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Iptc.Application2.Keywords                   String      8  vertebre
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Iptc.Application2.Keywords                   String      6  oiseau
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Iptc.Application2.Keywords                   String      7  animal2
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.digiKam.ColorLabel                       XmpText     1  0
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.digiKam.PickLabel                        XmpText     1  0
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.digiKam.TagsList                         XmpSeq      5  animal, vertebre, oiseau, faisan, _Digikam_root_tag_/animal2
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.BrightnessValue                     XmpText     5  6.2
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.ColorSpace                          XmpText     1  sRGB
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.CompressedBitsPerPixel              XmpText     3  4/1
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.Contrast                            XmpText     1  Normal
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.CustomRendered                      XmpText     1  Processus personnel
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.DateTimeDigitized                   XmpText    19  2008-05-10T19:27:13
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.DateTimeOriginal                    XmpText    19  2008:05:10 19:27:13
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.DigitalZoomRatio                    XmpText     5  0/100
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.ExifVersion                         XmpText     4  2.20
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.ExposureBiasValue                   XmpText     4  0 EV
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.ExposureMode                        XmpText     1  Automatique
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.ExposureProgram                     XmpText     1  Automatique
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.ExposureTime                        XmpText     7  10/4000
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.FNumber                             XmpText     5  F3.5
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.FileSource                          XmpText     1  Appareil photo numérique
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.FlashpixVersion                     XmpText     4  1.00
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.FocalLength                         XmpText     6  58.0 mm
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.FocalLengthIn35mmFilm               XmpText     3  380
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.GainControl                         XmpText     1  Aucun
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.LightSource                         XmpText     1  Inconnu
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.MaxApertureValue                    XmpText     5  36/10
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.MeteringMode                        XmpText     1  Multi-segments
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.PixelXDimension                     XmpText     4  2048
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.PixelYDimension                     XmpText     4  1536
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.Saturation                          XmpText     1  Normal
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.SceneCaptureType                    XmpText     1  Standard
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.SceneType                           XmpText     1  Photographié directement
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.Sharpness                           XmpText     1  Normal
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.SubjectDistanceRange                XmpText     1  Plan large
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.WhiteBalance                        XmpText     1  Automatique
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.ComponentsConfiguration             XmpSeq      4  YCbCr
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.Flash                               XmpText     0  type="Struct"
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.Flash/exif:Fired                    XmpText     5  False
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.Flash/exif:Function                 XmpText     5  False
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.Flash/exif:Mode                     XmpText     1  2
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.Flash/exif:RedEyeMode               XmpText     5  False
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.Flash/exif:Return                   XmpText     1  0
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.ISOSpeedRatings                     XmpSeq      1  80
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.exif.SubjectArea                         XmpSeq      1  1024 768 44 29
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.photoshop.DateCreated                    XmpText    10  2008-05-10
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.tiff.DateTime                            XmpText    19  2008-05-10T19:27:13
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.tiff.Make                                XmpText    17  Minolta Co., Ltd.
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.tiff.Model                               XmpText     9  DiMAGE Z1
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.tiff.Orientation                         XmpText     1  haut, gauche
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.tiff.ResolutionUnit                      XmpText     1  Pouce
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.tiff.Software                            XmpText    13  digiKam-2.8.0
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.tiff.XResolution                         XmpText     4  72
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.tiff.YCbCrPositioning                    XmpText     1  Co-sited
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.tiff.YResolution                         XmpText     4  72
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.xmp.CreateDate                           XmpText    19  2008-05-10T19:27:13
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.xmp.CreatorTool                          XmpText    13  digiKam-2.5.0
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.xmp.MetadataDate                         XmpText    19  2008-05-10T19:27:13
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.xmp.ModifyDate                           XmpText    19  2008-05-10T19:27:13
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.dc.subject                               XmpBag      4  animal2, vertebre, oiseau, faisan
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.MicrosoftPhoto.LastKeywordXMP            XmpSeq      5  animal, vertebre, oiseau, faisan, _Digikam_root_tag_/animal2
/media/Diskphotos/anvin/faisan_cran_aux_polets.jpg  Xmp.lr.hierarchicalSubject                   XmpBag      5  animal, vertebre, oiseau, faisan, _Digikam_root_tag_|animal2
----
A] Xmp.dc.subject XmpBag      4  animal2, vertebre, oiseau, faisan
is good, and I'm sure the animal2 tag has been write by Digikam and animal removed.
B ]Iptc.Application2.Keywords                   String      6  faisan
Iptc.Application2.Keywords                   String      8  vertebre
 Iptc.Application2.Keywords                   String      6  oiseau
 Iptc.Application2.Keywords                   String      7  animal2
are good, animal2 tag has been write (by digikam) and animal has been removed
C]Xmp.MicrosoftPhoto.LastKeywordXMP XmpSeq      5  animal, vertebre, oiseau, faisan, _Digikam_root_tag_/animal2
Has an error, animal is not removed but animal2 has been write with the _Digikam_root_tag
D]Xmp.digiKam.TagsList                         XmpSeq      5  animal, vertebre, oiseau, faisan, _Digikam_root_tag_/animal2
For the Xmp.digikam.TagsList, it's the same as for [C],  animal is not removed but animal2 has been write with the _Digikam_root_tag

Is the processes to get or to write data are the same for C and D (except the Xmp "container to which the metadata are written) ?

So I think there's some bug when writing or when getting tags to write, and this is the cause of some "other bugs" like database inconsistency (digikam.tags), image "disapearing when remove tags, old tags back when digikam read metadatas ...

The process must not be the same between SQLITE and MYSQL as the database table Tags hasn't the same organisation (two more columns, lft and rgt, for the mysql digikam.Tags table). Is hierarchy concept different between SQLITE and MYSQL ?

Greatings,

Eric
Comment 52 e.longuemare 2012-11-12 13:30:42 UTC
Hello,

Query on tags for the same image after reread the metadata (more/read metadata) :
Query Output:
> SELECT DISTINCT tagid, name,pid,lft,rgt FROM ImageTags,Tags WHERE imageid=1904 and tagid=id

+ ---------- + --------- + -------- + -------- + -------- +
| tagid      | name      | pid      | lft      | rgt      |
+ ---------- + --------- + -------- + -------- + -------- +
| 3          | Color Label None | 2        | 425      | 426      |
| 13         | Pick Label None | 2        | 405      | 406      |
| 17         | animal    | 0        | 384      | 385      |
| 18         | vertebre  | 0        | 382      | 383      |
| 23         | oiseau    | 0        | 372      | 373      |
| 43         | animal2   | 0        | 304      | 305      |
| 47         | faisan    | 0        | 296      | 297      |
+ ---------- + --------- + -------- + -------- + -------- +
7 rows

Nothing bad here. animal is back (it hasn't be remove from file metadata when suppress so read get it back)

When right click on the image, animal appear like this /_Digikam_root_tag/animal in supress tags.

Greatings,
Eric
Comment 53 e.longuemare 2012-11-12 13:56:20 UTC
Hello, 

suppress animal by right click on the image,supress tag,_Digikam_root_tag_ /animal.
All is good to in :
Query Output:
> SELECT DISTINCT tagid, name,pid,lft,rgt FROM ImageTags,Tags WHERE imageid=1904 and tagid=id

+ ---------- + --------- + -------- + -------- + -------- +
| tagid      | name      | pid      | lft      | rgt      |
+ ---------- + --------- + -------- + -------- + -------- +
| 3          | Color Label None | 2        | 425      | 426      |
| 13         | Pick Label None | 2        | 405      | 406      |
| 18         | vertebre  | 0        | 382      | 383      |
| 23         | oiseau    | 0        | 372      | 373      |
| 43         | animal2   | 0        | 304      | 305      |
| 47         | faisan    | 0        | 296      | 297      |
+ ---------- + --------- + -------- + -------- + -------- +
6 rows

But now when right click on picture, suppress, its _Digikam_root_tag/animal2 which appear.

and I have multiple _Digikam_root_tag in the file xmp :
 Xmp.digiKam.TagsList                         XmpSeq      8  animal, vertebre, oiseau, faisan, _Digikam_root_tag_/animal2, _Digikam_root_tag_/vertebre, _Digikam_root_tag_/oiseau, _Digikam_root_tag_/faisan

And tags will multiply ... so the hierarchie change with no "human readable schema" and all you tag work is gone as correct it tend to be worst and worst.

I think it's not a mysql fact, i never had mysql error log, perhaps something bad in a query,, or/and in reading and in writing.

Continue to looking for ,

Greatings,

Eric
Comment 54 qwexy 2012-11-13 11:58:41 UTC
(In reply to comment #25)
> Hello,
> In my database I did change in table "Tags" the entry "_Digikam_root_tag_"'s
> id 0 to -1.
> This solved my issue.
> Regards

Can anyone confirm the efficiency of this `hack`?
Comment 55 e.longuemare 2012-11-13 13:24:44 UTC
Hello,

for me it hasn't worked.

The issue I think is related in the use of mysql and reading or writing tags to pictures.

Now for me it works, but I decide to not write and reading tags to and from pictures.

As I use Digikam for many years, with SQLITE without a problem, tags where well write to IPTC by Digikam.

1 - Migration from Digikam
a) don't use the migration tool from Digikam (If tags were write before with DIGIKAM/SQLITE)
b)erase the "corrupted" mysql table (if migration have been done)
c)erase the corrupted tag in the pictures with something like this : 
exiftool -xmp:LastKeywordXMP= -xmp:TagsList= -xmp:hierarchicalSubject= *.jpg
tune as you want and backup your files before
d)start digikam, the collection is scan
e) don't tag anything and modify the Digikam/metadata option, disable at least, write Tags (the first line) with the option
f) now you should reorganise your Tags as you want

Now for me it is working fine. But I can't write Tags in file.

Backup you database.

I will try to look ahead on this "buggi" artefact with mysql (something between the code and the database wich haven't the same schema SQLITE/MYSQL).

Greatings,

Eric
Comment 56 e.longuemare 2012-11-13 13:54:16 UTC
Hello again,

>for me it hasn't worked.
as I had new pictures with tags,  the _Digikam_root_tag appear again, and corrupt the tags which was write to pictures ... creating new branches with pictures with same tag in a branch or another.

Greatings,

Eric
Comment 57 e.longuemare 2012-11-13 14:08:40 UTC
Hello,

using Digikam without writing and reading tags metadata from pictures "solve" this too :

https://bugs.kde.org/show_bug.cgi?id=230602.

Greatings,

Eric
Comment 58 e.longuemare 2013-02-24 17:40:38 UTC
Hello,

you should have a look here too :

http://ninedegreesbelow.com/photography/dam-software-metadata.html

Greatings,

Eric
Comment 59 e.longuemare 2013-02-24 18:07:16 UTC
related to this too :

https://bugs.kde.org/show_bug.cgi?id=268688
Comment 60 Alexander Meshcheryakov 2013-08-31 22:45:52 UTC
Occured for me with digiKam 3.3.0.

While tagging faces I got tag _Digikam_root_tag_ in tag list.

MariaDB [digikam4]> SELECT * FROM Tags WHERE name like '%Digikam%';
+----+------+-------------------------+------+---------+-----+-----+
| id | pid  | name                    | icon | iconkde | lft | rgt |
+----+------+-------------------------+------+---------+-----+-----+
|  0 |   -1 | _Digikam_root_tag_      |    0 | NULL    |   1 | 136 |
|  1 |    0 | _Digikam_Internal_Tags_ |    0 | NULL    |  90 | 135 |
| 87 |    0 | _Digikam_root_tag_      |    0 | NULL    |   2 |   5 |
+----+------+-------------------------+------+---------+-----+-----+

After removing _Digikam_root_tag_  from digiKam UI and restarting of digiKam I do not see any tags in digiKam, but

MariaDB [digikam4]> SELECT COUNT(*) FROM Tags;
+----------+
| COUNT(*) |
+----------+
|       63 |
+----------+

MariaDB [digikam4]> SELECT COUNT(*) FROM Tags WHERE name like '%People%';
+----------+
| COUNT(*) |
+----------+
|        0 |
+----------+

Looks like my DB is messed up and I have to recreate it.

MySQL binlogs indicate that extra _Digikam_root_tag_ were created by following queries

#130831 23:12:15 server id 1  end_log_pos 65360732      Intvar
SET INSERT_ID=87/*!*/;
# at 65360732
#130831 23:12:15 server id 1  end_log_pos 65360780      User_var
SET @`myLeft`:=1/*!*/;
# at 65360780
#130831 23:12:15 server id 1  end_log_pos 65360942      Query   thread_id=8340  exec_time=0     error_code=0
SET TIMESTAMP=1377976335/*!*/;
INSERT INTO Tags(name, pid, lft, rgt) VALUES('_Digikam_root_tag_', 0, @myLeft + 1, @myLeft + 2)
Comment 61 caulier.gilles 2014-08-08 08:52:09 UTC
veaceslav,

outside the fact that people try to investigate the origin of this problem by an analysis of database tag structures, i think you have solved this issue recently to drop older and unwanted tags to plug in database from image metadata.

Right ?

See comment #10 for details.

Gilles Caulier
Comment 62 Veaceslav Munteanu 2014-08-08 09:01:23 UTC
I added checks and sanitize functionality for Image Scanner and to metadata write functionality.

But I don't know how to sanitize an existing database with _Digikam_root_tags_ in it rather than writing tags to image, drop everything and re-read them back..
Comment 63 caulier.gilles 2014-08-08 09:36:03 UTC
The database marked with older and obsolete tags is a fact. 

At least with 4.2.0, these tags will must never re-appear after a cleanup of database content and a sync from image metadata to database.

Gilles Caulier
Comment 64 caulier.gilles 2014-08-08 09:37:23 UTC
To all people in this room who have experience this problem, i recommend to test with digiKam 4.2.0 where Veaceslav have patched image scanner to prevent post creation of obsolete tags in database.

Gilles Caulier
Comment 65 caulier.gilles 2014-09-01 21:15:13 UTC
*** Bug 325331 has been marked as a duplicate of this bug. ***
Comment 66 caulier.gilles 2015-11-24 15:16:45 UTC
From Marcel Wiesweg, by private email :

"I believe the root of the problem is the TagsTree table. This table is only maintained to allow searching in a tag including all child tags. In SQLite, it always worked, in MySQL, there were problems and a solution with another tree structure which I have never really understood.
This tree seems to create a lot of problems.

Alternative solution for the problem is to find in the C++ search code, all child tags (readily available from TagsCache), and add them as bound values (WHERE tagid IN (?,?,?....)).
This was limited for SQLite which only supports 999 bound values, and that limit can be hit easily.

For MySQL, the limit appears to be 65536, which is feasible. Optimizations are possible (using boost interval etc.)"
Comment 67 swatilodha27 2016-05-26 11:33:21 UTC
This is still an issue with digikam5.0.0-beta6 version.

I'm able to reproduce it.

My log:

MariaDB [digikam]> select * from Tags;  
+----+------+----------------------------+------+---------+-----+-----+
| id | pid  | name                       | icon | iconkde | lft | rgt |
+----+------+----------------------------+------+---------+-----+-----+
|  0 |   -1 | _Digikam_root_tag_         | NULL | NULL    |   1 |  80 |
|  1 |    0 | _Digikam_Internal_Tags_    | NULL | NULL    |  38 |  79 |
|  2 |    1 | Original Version           | NULL | NULL    |  77 |  78 |
|  3 |    1 | Intermediate Version       | NULL | NULL    |  75 |  76 |
|  4 |    1 | Current Version            | NULL | NULL    |  73 |  74 |
|  5 |    1 | Version Always Visible     | NULL | NULL    |  71 |  72 |
|  6 |    0 | People                     | NULL | NULL    |  22 |  37 |
|  7 |    6 | Monica Geller              | NULL | NULL    |  35 |  36 |
|  8 |    6 | Ross Geller                | NULL | NULL    |  33 |  34 |
|  9 |    6 | Phoebe Buffay              | NULL | NULL    |  31 |  32 |
| 10 |    6 | Joey Tribbiani             | NULL | NULL    |  29 |  30 |
| 11 |    0 | friends                    | NULL | NULL    |  20 |  21 |
| 12 |    6 | Chandler Bing              | NULL | NULL    |  27 |  28 |
| 13 |    6 | Rachel Green               | NULL | NULL    |  25 |  26 |
| 14 |    1 | Color Label None           | NULL | NULL    |  69 |  70 |
| 15 |    1 | Color Label Red            | NULL | NULL    |  67 |  68 |
| 16 |    1 | Color Label Orange         | NULL | NULL    |  65 |  66 |
| 17 |    1 | Color Label Yellow         | NULL | NULL    |  63 |  64 |
| 18 |    1 | Color Label Green          | NULL | NULL    |  61 |  62 |
| 19 |    1 | Color Label Blue           | NULL | NULL    |  59 |  60 |
| 20 |    1 | Color Label Magenta        | NULL | NULL    |  57 |  58 |
| 21 |    1 | Color Label Gray           | NULL | NULL    |  55 |  56 |
| 22 |    1 | Color Label Black          | NULL | NULL    |  53 |  54 |
| 23 |    1 | Color Label White          | NULL | NULL    |  51 |  52 |
| 24 |    1 | Pick Label None            | NULL | NULL    |  49 |  50 |
| 25 |    1 | Pick Label Rejected        | NULL | NULL    |  47 |  48 |
| 26 |    1 | Pick Label Pending         | NULL | NULL    |  45 |  46 |
| 27 |    1 | Pick Label Accepted        | NULL | NULL    |  43 |  44 |
| 28 |    6 | Joey Tribbianii            | NULL | NULL    |  23 |  24 |
| 29 |    0 | singer                     | NULL | NULL    |  10 |  19 |
| 30 |   29 | adam                       | NULL | NULL    |  17 |  18 |
| 31 |   29 | ellie_goulding             | NULL | NULL    |  15 |  16 |
| 32 |   29 | enrique                    | NULL | NULL    |  13 |  14 |
| 33 |   29 | eminem                     | NULL | NULL    |  11 |  12 |
| 34 |    1 | Need Resolving History     | NULL | NULL    |  41 |  42 |
| 35 |    1 | Need Tagging History Graph | NULL | NULL    |  39 |  40 |
| 36 |    0 | smiley                     | NULL | NULL    |   4 |   9 |
| 37 |   36 | cry_laugh                  | NULL | NULL    |   7 |   8 |
| 38 |   36 | tongue_out                 | NULL | NULL    |   5 |   6 |
| 39 |    0 | nature                     | NULL | NULL    |   2 |   3 |
+----+------+----------------------------+------+---------+-----+-----+
40 rows in set (0.00 sec)
Comment 68 caulier.gilles 2016-05-26 12:31:59 UTC
Yes, it is. Look in Mysql DB schema :

https://quickgit.kde.org/?p=digikam.git&a=blob&h=5fd4abfe3318e37cba448551a769325217590ff2&hb=ebba4691ef367bbe15bd2b2c8dfe6e582b1668f5&f=data%2Fdatabase%2Fdbconfig.xml.cmake.in#l1202

About this topic, Richard Mortimer has already take a look into this file :

https://bugs.kde.org/show_bug.cgi?id=355831

... to fix this problem with a patch, if i'm not too wrong... but this do not work. Look at comment #55 for details :

https://bugs.kde.org/show_bug.cgi?id=355831#c55

And my test results at comment #59 :

https://bugs.kde.org/show_bug.cgi?id=355831#c59

In all cases, there are a lots of information in bug #355831 for your GSoC 2016 project.

Gilles Caulier
Comment 69 Richard Mortimer 2016-05-26 13:12:19 UTC
First step to resolve this has to be to add UNIQUE(name, pid) to the MySQL version of the Tags table (around line 1056 in dbconfig.xml.cmake).

That will at least force MySQL to reject any attempts to add duplicates. Once that is done then it should be easier to find out why digikam is trying to add the duplicates in the first place.
Comment 70 e.longuemare 2016-05-26 13:44:04 UTC
Hello,

I still use digikam 3.5 with mysql.

As I don't write tags to pictures, only mysql support, I have had never again a double _digikam_root_tag. 

Exception : importing some images that aren't mine and that include tags (forget to erase them with exiftool before collection scan/digikam start).  

hope it will helps.

Eric
Comment 71 swatilodha27 2016-05-26 14:19:27 UTC
(In reply to Richard Mortimer from comment #69)
> First step to resolve this has to be to add UNIQUE(name, pid) to the MySQL
> version of the Tags table (around line 1056 in dbconfig.xml.cmake).
> 
> That will at least force MySQL to reject any attempts to add duplicates.
> Once that is done then it should be easier to find out why digikam is trying
> to add the duplicates in the first place.

Is this fine?

CREATE TABLE `Tags` (
    ->   `id` int(11) NOT NULL AUTO_INCREMENT,
    ->   `pid` int(11) DEFAULT NULL UNIQUE,
    ->   `name` varchar(100) CHARACTER SET utf8 NOT NULL UNIQUE,
    ->   `icon` int(11) DEFAULT NULL,
    ->   `iconkde` longtext CHARACTER SET utf8,
    ->   `lft` int(11) NOT NULL,
    ->   `rgt` int(11) NOT NULL,
    ->   PRIMARY KEY (`id`),
    ->   KEY `Tags_Images` (`icon`),
    ->   CONSTRAINT `Tags_Images` FOREIGN KEY (`icon`) REFERENCES `Images` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
    -> ) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8mb4; 

For column 'name' I changed from TEXT to VARCHAR ('cause it gave error: TEXT/BLOB column 'name' used in key specification without key length)
Comment 72 Richard Mortimer 2016-05-26 14:41:48 UTC
I've tended to keep LONGTEXT and use a length on the index. That way a long tag name will not totally break things - but will likely cause unexpected behaviour.

Try

CREATE TABLE IF NOT EXISTS Tags
                            (id INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT,
                            pid INTEGER,
                            name LONGTEXT CHARACTER SET utf8 NOT NULL,
                            icon INTEGER,
                            iconkde LONGTEXT CHARACTER SET utf8,
                            lft INT NOT NULL,
                            rgt INT NOT NULL,
                            UNIQUE(pid, name(100)),
                            CONSTRAINT Tags_Images FOREIGN KEY (icon) REFERENCES Images (id) ON DELETE SET NULL ON UPDATE CASCADE
                            ) ENGINE InnoDB;
Comment 73 swatilodha27 2016-07-08 09:29:19 UTC
Created attachment 99945 [details]
To remove duplicates from Tags table
Comment 74 swatilodha27 2016-07-08 17:06:10 UTC
Created attachment 99951 [details]
Removes _Digikam_root_tag_ from GUI
Comment 75 swatilodha27 2016-07-08 19:07:14 UTC
Created attachment 99954 [details]
Combined patch

1) Avoid duplicates in Tags table
2) Removes _digikam_root_tag_ from UI
Comment 76 Richard Mortimer 2016-07-12 12:17:44 UTC
Looks good to me.
Comment 77 swatilodha27 2016-07-12 21:28:42 UTC
Created attachment 100044 [details]
Please test this with latest git/master and see if this fix this issue.
Comment 78 swatilodha27 2016-07-12 21:30:04 UTC
Created attachment 100045 [details]
Please test this with latest git/master and see if this fix this issue.
Comment 79 caulier.gilles 2016-07-15 12:01:39 UTC
Tested here. Context :

- Mysql DB from host Linux computer
- DK  client running on a Linux under a VM.
- VM is connected to host DB through the network.
- DB on host is build from scratch.

* _Digikam_root_tag_ still in DB schema. It's the expected behavior ?
* The _Digikam_root_tag_ is always here in  Face tree-view while face scan is started, and also when the task is completed.
* The initial collection scan is very slow. There is a time latency when a file is registered in DB. We can see it on the console. The collection contents is this one :

digikam version 5.1.0
Images: 
JP2: 10
JPG: 1806
PGF: 7
PNG: 144
PPM: 2
RAW-ARW: 66
RAW-CR2: 90
RAW-CRW: 5
RAW-DCR: 2
RAW-DNG: 32
RAW-MRW: 18
RAW-NEF: 19
RAW-ORF: 4
RAW-PEF: 7
RAW-RAF: 10
RAW-RAW: 1
RAW-RW2: 8
RAW-RWL: 1
RAW-X3F: 2
TIFF: 28
total: 2262
: 
Videos: 
3GP: 1
MKV: 1
MOV: 6
MP4: 1
total: 9
: 
Total Items: 2271
Albums: 196
Tags: 97
: 
Database backend: QMYSQL
Host Name: 192.168.1.20
Host Port: 3306
User account: digikamuser
Connect options: 
Core Db name: digikam
Thumbs Db name: digikam
Face Db name: digikam

So for me this patch to do work the job.

Gilles Caulier
Comment 80 swatilodha27 2016-07-15 13:02:55 UTC
(In reply to caulier.gilles from comment #79)
> Tested here. Context :
skip...
> * _Digikam_root_tag_ still in DB schema. It's the expected behavior ?
Yes. The tag would be present in the schema, but not visible in UI.

> * The _Digikam_root_tag_ is always here in  Face tree-view while face scan
> is started, and also when the task is completed.
Could you please attach a screenshot, showing _Digikam_root_tag_  in Face tree view?
> 

Thanks for testing!
Comment 81 caulier.gilles 2016-07-15 13:07:30 UTC
digiKam 5.1.0 screenhot with root tag in face tree-view:

https://www.flickr.com/photos/digikam/28219572102/in/dateposted-public/

Gilles Caulier
Comment 82 caulier.gilles 2016-07-15 20:40:07 UTC
root tag in Tags view from left and right sidebars.

https://www.flickr.com/photos/digikam/27714438463/in/dateposted-public/

Gilles Caulier
Comment 83 swatilodha27 2016-07-15 21:34:25 UTC
Created attachment 100118 [details]
Updated patch

Still the same results?
Comment 84 Maik Qualmann 2016-07-16 05:29:58 UTC
In an old DB the tag _Digikam_root_tag_ still exists. When a new DB is created, the tag _Digikam_root_tag_ no longer appear. Do we need QRegExp? Is enough no simple QLatin1String?

Maik
Comment 85 caulier.gilles 2016-07-16 06:13:43 UTC
Maik, 
i cannot confirm your comment #84. I run digiKam with patch version 100045 with a fresh database (i delete /var/lib/mysql and restart mysqld to be sure. The DB created is clean. I create myself the digiKam DB in Mysql repository using SQL statements  from DK config panel. After the first scan, the _root_ tag appear in left and right Tags panels.

Gilles
Comment 86 caulier.gilles 2016-07-16 06:16:22 UTC
Maik, 

Do you seen any slow down performance with a fresh DB created, typically at first scan ? Look in the console if registration to DB take time latency (1/2 seconds here). Previously, i never see this with remote Mysql DB (same computer, same configuration)

Gilles Caulier
Comment 87 Maik Qualmann 2016-07-16 06:21:31 UTC
Gilles,

I have tested it with patch #100118.

Maik
Comment 88 Maik Qualmann 2016-07-16 06:27:05 UTC
Gilles,

No slow DB access with a new internal DB on the first scan here.

Maik
Comment 89 swatilodha27 2016-07-16 06:29:38 UTC
(In reply to Maik Qualmann from comment #84)
> In an old DB the tag _Digikam_root_tag_ still exists. When a new DB is
> created, the tag _Digikam_root_tag_ no longer appear. Do we need QRegExp? Is
> enough no simple QLatin1String?

I think QRegExp is fine to use here for pattern matching in the strings.
Comment 90 caulier.gilles 2016-07-16 06:40:59 UTC
Maik,

Currently i test with new version patch. Do you seen that splashscreen is frozen on screen while long first scanning without any progress indicator and without any text message on the top ?

https://www.flickr.com/photos/digikam/27722159883/in/dateposted-public/

In fact, while scanning, the Progress dialog must be show in all cases, even if user turn on splashscreen option. In this last case, the splashscreen must be show when scan is completed. It will appear few seconds only, and it's enough.

There is already a report open about this topic in bugzilla if i remember.

Gilles
Comment 91 caulier.gilles 2016-07-16 06:44:54 UTC
Another problem : If images in collection have been previously managed with option to save tags in image metadata, the _root_ tags will be restored in a fresh database.

I'm sure that my  collection is in this use case.

I don't know if metadata hub has already the rules to drop this internal tag while scanning.

Gilles
Comment 92 caulier.gilles 2016-07-16 06:47:55 UTC
The first scan is complete with the new patch version. It took 20 mn !

The _root_ tag is not restored. So it's not present in my images metadata or Metadata Hub do the job properly. This point still to verify to be sure.

So the new patch version look better until now.

Now i start the face detection scan to see if _root_ tag is recreated.

Gilles
Comment 93 caulier.gilles 2016-07-16 06:49:23 UTC
Note : Face Scan is started with "Clear unconfirmed results and rescan" + "Detect faces" options.

Gilles
Comment 94 caulier.gilles 2016-07-16 08:44:27 UTC
I confirm : new patch is really better as not _root_ tag appear in tree-view after face scan. Good job Swati...

Gilles
Comment 95 caulier.gilles 2016-07-16 08:46:19 UTC
Now i will scan items to generate fuzzy fingerprints to find duplicates.

Gilles
Comment 96 caulier.gilles 2016-07-16 08:54:43 UTC
Maik,

metadathub.cpp::line 553 and imagescanner.cpp::line 840 has all rules to prevent _root_ tag to be imported to DB.

So for your problem "In an old DB the tag _Digikam_root_tag_ still exists", I think a migration rule must be written to clean up the registration of internal tag to items. 

Swati, what do you think about ?

Gilles
Comment 97 caulier.gilles 2016-07-16 09:02:56 UTC
The fuzzy FingerPrints process is done. No _root_ tag here...

I restarted digiKam  just to be sure, no _root_ tag here...

Gilles
Comment 98 swatilodha27 2016-07-16 09:24:14 UTC
(In reply to caulier.gilles from comment #94)
> I confirm : new patch is really better as not _root_ tag appear in tree-view
> after face scan. Good job Swati...

Thank you!

(In reply to caulier.gilles from comment #96)
> Maik,
> 
> metadathub.cpp::line 553 and imagescanner.cpp::line 840 has all rules to
> prevent _root_ tag to be imported to DB.
> 
> So for your problem "In an old DB the tag _Digikam_root_tag_ still exists",
> I think a migration rule must be written to clean up the registration of
> internal tag to items. 

Could you please elaborate on this?
Comment 99 caulier.gilles 2016-07-16 09:28:34 UTC
"In an old DB the tag _Digikam_root_tag_ still exists"

It's clear. If this tag still appear in tree-view, certainly it's assigned to item as well (as a normal tag). As Maik can reproduce the problem (not me), he can check this kind of situation in DB.

If it's the case, well something must be done to remove these assignation in older database : a migration of contents to prevent _root_ tag visibility in treeview.

Gilles
Comment 100 e.longuemare 2016-07-16 09:47:07 UTC
Hello,

Le samedi 16 juillet 2016 à 09:28 +0000, via KDE Bugzilla a écrit :
> https://bugs.kde.org/show_bug.cgi?id=283323
> 
> --- Comment #99 from caulier.gilles@gmail.com ---
> "In an old DB the tag _Digikam_root_tag_ still exists"
> 
> It's clear. If this tag still appear in tree-view, certainly it's assigned to
> item as well (as a normal tag). As Maik can reproduce the problem (not me), he
> can check this kind of situation in DB.

As I have said in a earlyer response :

1 - clear all embedded metadata from image before "scanning" it with
Digikam make disapear extra "_digikam_root_tag"

2 - don't write metadata to image with digikam (only stored in mysql
db), prevent digikam to fill mysql db with extra "_digikam_root_tag"

3 - forgive to erase metadata from image before "scanning", should make
"_digikam_root_tag" appear again, even if image has no embeded
"_digikam_root_tag".

I have it working like this (no metadata writed to image, and only
stored in mysql) with old digikam 3.5 and mysql on a
multi-digikam-client config

Greatings,

Eric


> 
> If it's the case, well something must be done to remove these assignation in
> older database : a migration of contents to prevent _root_ tag visibility in
> treeview.
> 
> Gilles
>
Comment 101 caulier.gilles 2016-07-16 09:58:27 UTC
Git commit eb6318a45efe1e08f35da450633f3bcb1027fd6a by Swati Lodha.
Committed on 16/07/2016 at 09:51.
Pushed by swatil into branch 'master'.

Remove _digikam_root_tag_ from tag tree-view

M  +3    -1    data/database/dbconfig.xml.cmake.in
M  +8    -1    libs/database/tags/facetags.cpp
M  +10   -2    libs/database/tags/tagscache.cpp

http://commits.kde.org/digikam/eb6318a45efe1e08f35da450633f3bcb1027fd6a
Comment 102 swatilodha27 2016-07-17 08:13:27 UTC
Maik

Could this file be closed now, with the last commit?

Thanks!
Comment 103 Simon 2017-01-13 09:07:35 UTC
*** Bug 374988 has been marked as a duplicate of this bug. ***