Bug 440919 - SQlite - Mysql internal name-tag migrating error
Summary: SQlite - Mysql internal name-tag migrating error
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Database-Migration (other bugs)
Version First Reported In: 7.4.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-13 08:48 UTC by HJ
Modified: 2021-08-17 16:28 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 7.4.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description HJ 2021-08-13 08:48:05 UTC
SUMMARY
SQlite - Mysql internal tag migrating error

STEPS TO REPRODUCE
1. An error message always appears in the same place
2.4932] digikam.coredb: Core database: query isOnValidRow [ true ] isActive [ true ] result size: [ -1 ]
[14932] digikam.coredb: Core database: column: [ "id" ] value [ QVariant(qlonglong, 1772) ]
[14932] digikam.coredb: Core database: column: [ "pid" ] value [ QVariant(qlonglong, 1733) ]
[14932] digikam.coredb: Core database: column: [ "name" ] value [ QVariant(QString, "Aare Miller") ]
[14932] digikam.coredb: Core database: column: [ "icon" ] value [ QVariant(qlonglong, 182090) ]
[14932] digikam.coredb: Core database: column: [ "iconkde" ] value [ QVariant(QString, "") ]
[14932] digikam.coredb: Core database: query isOnValidRow [ true ] isActive [ true ] result size: [ -1 ]
[14932] digikam.coredb: Core database: column: [ "id" ] value [ QVariant(qlonglong, 1773) ]
[14932] digikam.coredb: Core database: column: [ "pid" ] value [ QVariant(qlonglong, 1733) ]
[14932] digikam.coredb: Core database: column: [ "name" ] value [ QVariant(QString, "Kaja Kartau (Lainde)") ]
[14932] digikam.coredb: Core database: column: [ "icon" ] value [ QVariant(qlonglong, 308120) ]
[14932] digikam.coredb: Core database: column: [ "iconkde" ] value [ QVariant(QString, "") ]
[14932] digikam.dbengine: Failure executing query:
[14932]  "\n                    REPLACE INTO Tags (id, pid, name, icon, iconkde) VALUES (?, ?, ?, ?, ?);\n                " 
[14932] Error messages: "QMYSQL3: Unable to execute statement" "Cannot add or update a child row: a foreign key constraint fails (`digikam`.`tags`, CONSTRAINT `Tags_Images` FOREIGN KEY (`icon`) REFERENCES `images` (`id`) ON DELETE SET NULL ON UPDATE CASCADE)" "1452" 2 
[14932] Bound values:  (QVariant(qlonglong, 1773), QVariant(qlonglong, 1733), QVariant(QString, "Kaja Kartau (Lainde)"), QVariant(qlonglong, 308120), QVariant(QString, ""))
[14932] digikam.dbengine: Error while executing DBAction [ "Migrate_Write_Tags" ] Statement [ "\n                    REPLACE INTO Tags (id, pid, name, icon, iconkde) VALUES (:id, :pid, :name, :icon, :iconkde);\n                " ]
[14932] digikam.coredb: Core database: error while converting table data. Details: QSqlError("1452", "QMYSQL3: Unable to execute statement", "Cannot add or update a child row: a foreign key constraint fails (`digikam`.`tags`, CONSTRAINT `Tags_Images` FOREIGN KEY (`icon`) REFERENCES `images` (`id`) ON DELETE SET NULL ON UPDATE CASCADE)")
[14932] digikam.databaseserver: Running 930 seconds...
 
3. What could be the reason for the failure?

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Maik Qualmann 2021-08-13 09:18:43 UTC
You have set a tag symbol from a image, but the image no longer exists.

Maik
Comment 2 HJ 2021-08-13 10:33:05 UTC
I deleted all the persons tag symbols and then the error did not recur.
I couldn't see which tag symbol image no longer exists.

Hannes
Comment 3 Maik Qualmann 2021-08-13 11:12:39 UTC
The problem was triggered by a symbol in the tag "Kaja Kartau (Lainde)". Normally, when deleting images, the entry is set to "NULL" in the Tags table. For some reason (crash?) It was not reset at some point.

Maik
Comment 4 HJ 2021-08-13 11:37:13 UTC
Previously, I only used jpg image files. But at some point, I decided to replace the scanned images with the tif format. And the tag symbols image has also been selected from the deleted jpg images and there have really been a lot of crashes during the operation, I thought it more appropriate to reset the tag symbols images.
But in any case, many thanks for the quick response.

Hannes
Comment 5 Maik Qualmann 2021-08-17 16:28:10 UTC
Git commit 5020f0ea87dac93c5d39c6369efc5be5e30f4bd3 by Maik Qualmann.
Committed on 17/08/2021 at 16:27.
Pushed by mqualmann into branch 'master'.

copy the tags icon with an extra job like the albums icon
FIXED-IN: 7.4.0

M  +1    -1    NEWS
M  +22   -6    core/data/database/dbconfig.xml.cmake.in
M  +2    -0    core/libs/database/coredb/coredbcopymanager.cpp
M  +1    -1    core/libs/database/utils/widgets/dbmigrationdlg.cpp

https://invent.kde.org/graphics/digikam/commit/5020f0ea87dac93c5d39c6369efc5be5e30f4bd3