Fix one DB query which failed for MySQL storage and could lead to DB inconsistencies.

This commit is contained in:
Martin Rotter 2016-11-08 20:19:22 +01:00
parent d0a40ab3a4
commit 9e66dc9f20

View file

@ -617,8 +617,8 @@ int DatabaseQueries::updateMessages(QSqlDatabase db,
// Now, fixup custom IDS for messages which initially did not have them,
// just to keep the data consistent.
if (db.exec("UPDATE Messages "
"SET custom_id = (SELECT id FROM Messages t WHERE t.id = Messages.id) "
"WHERE Messages.custom_id IS NULL OR Messages.custom_id = '';").lastError().isValid()) {
"SET custom_id = id "
"WHERE custom_id IS NULL OR custom_id = '';").lastError().isValid()) {
qWarning("Failed to set custom ID for all messages: '%s'.", qPrintable(db.lastError().text()));
}