diff --git a/application/helpers/update/updatedb_helper.php b/application/helpers/update/updatedb_helper.php index d7ff162228f..3daac29d99c 100644 --- a/application/helpers/update/updatedb_helper.php +++ b/application/helpers/update/updatedb_helper.php @@ -8060,6 +8060,14 @@ function regenerateLabelCodes400(int $lid, $hasLanguageColumn = true) sprintf("SELECT * FROM {{labelsets}} WHERE lid = %d", (int) $lid) )->queryRow(); if (empty($labelSet)) { + // No belonging label set, remove orphan labels. + // @see https://bugs.limesurvey.org/view.php?id=17608 + $oDB->createCommand( + sprintf( + 'DELETE FROM {{labels}} WHERE lid = %d', + (int) $lid + ) + )->execute(); return; }