Bug 433850

Summary: Not able to delete any tags
Product: [Applications] digikam Reporter: benjcmin <benjcmin>
Component: Tags-EngineAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, metzpinguin
Priority: NOR    
Version: 7.2.0   
Target Milestone: ---   
Platform: macOS (DMG)   
OS: macOS   
Latest Commit: Version Fixed In: 7.2.0
Sentry Crash Report:
Attachments: Metadata preferences

Description benjcmin 2021-03-02 10:43:07 UTC
Created attachment 136318 [details]
Metadata preferences

SUMMARY
using the 7.2.0 rc I'm not able to delete any tags. After restart of Digikam there are all there again.

STEPS TO REPRODUCE
1. right click on tag "xyz" choose delete / same for using tag management and choosing to delete all tags from DB
2. Tag is gone 
3. Restart Digikam Tag is there again.

OBSERVED RESULT
Tags reapear after restart of Digikam

EXPECTED RESULT
Tag should be deleted

SOFTWARE/OS VERSIONS
macOS: 10.15.7 


ADDITIONAL INFORMATION
N/a
Comment 1 caulier.gilles 2021-03-02 10:48:18 UTC
Which kind of database do you use exactly ? sqlite, mysql (local or remote) ?

What do you seen as debug trace when you start digiKam from a Terminal following instructions here :

https://www.digikam.org/contribute/

Gilles Caulier
Comment 2 benjcmin 2021-03-02 10:53:42 UTC
I'm using the internal mysql as DB (local).

output of terminal start:
QCommandLineParser: already having an option named "h"
QCommandLineParser: already having an option named "help-all"
QCommandLineParser: already having an option named "v"
dbus[91252]: Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
QtAV 1.13.0(Feb 28 2021, 23:03:11)
Multimedia framework base on Qt and FFmpeg.
Distributed under the terms of LGPLv2.1 or later.
Shanghai, China Copyright (C) 2012-2019 Wang Bin (aka. Lucas Wang) wbsecg1@gmail.com
Donate: http://qtav.org/donate.html
Source: https://github.com/wang-bin/QtAV
Home page: http://qtav.org
kf.xmlgui: Unhandled container to remove :  Digikam::DigikamApp
digikam.database: No location could be retrieved for ""
QFSFileEngine::open: No file name specified
Comment 3 caulier.gilles 2021-03-02 10:56:27 UTC
Before to run digiKAm in the Terminal, you need to enable debug traces :

    export QT_LOGGING_RULES="digikam*=true"
    /Applications/digiKam.org/digikam.app/Contents/MacOS/digikam

Gilles Caulier
Comment 4 benjcmin 2021-03-02 10:59:47 UTC
got it:
digikam.dbengine: Failure executing query:
 "DELETE FROM Tags WHERE id=?;" 
Error messages: "QMYSQL3: Unable to execute statement" "You can't specify target table 'TagsTree' for update in FROM clause" "1093" 2 
Bound values:  (QVariant(int, 65))
digikam.dbengine: Error while executing DBAction [ "DeleteTag" ] Statement [ "DELETE FROM Tags WHERE id=:tagID;" ]
digikam.geoiface: ----
digikam.geoiface: ----
digikam.general: Stacked View Mode :  0
digikam.general: Delete Shortcut assigned to tag  65
digikam.geoiface: ----
Comment 5 Maik Qualmann 2021-03-02 11:41:00 UTC
The problem is clear, you are using MySQL and not MariaDB, I will fix it tonight, but you will either have to start with a new database or copy the existing one to a new one with the migration tool. We will not add another MySQL update within the digiKam-7.2.0 test versions. We strongly recommend using MariaDB instead of MySQL.

Maik
Comment 6 benjcmin 2021-03-02 11:46:40 UTC
I would be fine using MariaDB, I just installed the rc over my existing installation. So wasn't even aware there is the "option" of using MariaDB.
Also fine with starting with a complete new DB which I already tried to accomplish but failed. But that's not a bug but rather a user problem as I just couldn't find a way to have Digikam start with a clean DB. Just deleting/moving the old DB leads to an error message, then digikam trying to connect to an DB which won't happen and canceling the connecting dialog crashes digikam completly.
Comment 7 Maik Qualmann 2021-03-02 18:15:08 UTC
Git commit a9823b4121480024a1968272e2fb7e0c37e9887c by Maik Qualmann.
Committed on 02/03/2021 at 18:14.
Pushed by mqualmann into branch 'master'.

fix TagsTree trigger to delete tag  under MySQL
FIXED-IN: 7.2.0

M  +2    -1    NEWS
M  +4    -2    core/data/database/dbconfig.xml.cmake.in

https://invent.kde.org/graphics/digikam/commit/a9823b4121480024a1968272e2fb7e0c37e9887c
Comment 8 Maik Qualmann 2021-03-02 18:46:00 UTC
Git commit a966c9d0d24bcc651e0903bcc635e273ab5d8a1f by Maik Qualmann.
Committed on 02/03/2021 at 18:44.
Pushed by mqualmann into branch 'master'.

update database to V12 due to the changes to the triggers

M  +41   -0    core/data/database/dbconfig.xml.cmake.in
M  +7    -1    core/libs/database/coredb/coredbschemaupdater.cpp

https://invent.kde.org/graphics/digikam/commit/a966c9d0d24bcc651e0903bcc635e273ab5d8a1f
Comment 9 benjcmin 2021-03-02 18:53:20 UTC
Thx Maik.
But this sounds maybe like a stupid question how do I get Digikam to use MariaDB instead of MySQL.
I just used the pkg installers and thought those come with MariaDB.
KR Benjamin
Comment 10 benjcmin 2021-03-02 19:31:32 UTC
(In reply to Maik Qualmann from comment #5)
> The problem is clear, you are using MySQL and not MariaDB, I will fix it
> tonight, but you will either have to start with a new database or copy the
> existing one to a new one with the migration tool. We will not add another
> MySQL update within the digiKam-7.2.0 test versions. We strongly recommend
> using MariaDB instead of MySQL.
> 
> Maik

Are you sure I'm still using the MySQL

when I start Digikma it uses the mysqld from a mariadb folder inside the digikam package:
   Internal Server Serv Cmd: "/Applications/digiKam.org/digikam.app/Contents/lib/mariadb/bin/mysqld"
   Internal Server Init Cmd: "/Applications/digiKam.org/digikam.app/Contents/lib/mariadb/bin/mysql_install_db"
Comment 11 Maik Qualmann 2021-03-02 19:57:15 UTC
So this error message is specific to MySQL:

Error messages: "QMYSQL3: Unable to execute statement" "You can't specify target table 'TagsTree' for update in FROM clause" "1093" 2 

We already know them from moving tags. Do you use the internal or external MySQL server setting?

Maik
Comment 12 benjcmin 2021-03-02 20:45:06 UTC
(In reply to Maik Qualmann from comment #11)
> So this error message is specific to MySQL:
> 
> Error messages: "QMYSQL3: Unable to execute statement" "You can't specify
> target table 'TagsTree' for update in FROM clause" "1093" 2 
> 
> We already know them from moving tags. Do you use the internal or external
> MySQL server setting?
> 
> Maik

I'm using the internal MySQL setting.
Comment 13 Maik Qualmann 2021-03-02 21:27:26 UTC
Hmm, the MariaDB version on MacOS may be a bit older. It will definitely be fixed with the next version and we are also doing a DB update.

Maik