diff --git a/src/services/Gc.php b/src/services/Gc.php index b711eecc67d..3b234f51c13 100644 --- a/src/services/Gc.php +++ b/src/services/Gc.php @@ -556,7 +556,7 @@ private function _deleteOrphanedFkRows(): void } else { $sql = <<name t -WHERE t.$fkColumn IS NOT NULL +WHERE t."$fkColumn" IS NOT NULL AND NOT EXISTS ( SELECT * FROM $refTable WHERE "$pkColumn" = t."$fkColumn"