Newer
Older
--- apps/polls/lib/Db/TableManager.php 2023-06-21 12:38:02.300193982 +0200
+++ apps/polls/lib/Db/TableManager-patched.php 2023-06-21 12:48:45.144957659 +0200
@@ -312,12 +312,18 @@
if ($this->schema->hasTable($this->dbPrefix . $table)) {
// identify duplicates
$selection = $qb->selectDistinct('t1.id')
- ->from($table, 't1')
- ->innerJoin('t1', $table, 't2')
- ->where($qb->expr()->lt('t1.id', 't2.id'));
+ ->from($table, 't1')
+ ->innerJoin('t1', $table, 't2', $qb->expr()->lt('t1.id', 't2.id'));
+
+ $i = 0;
foreach ($columns as $column) {
- $selection->andWhere($qb->expr()->eq('t1.' . $column, 't2.' . $column));
+ if ($i > 0) {
+ $selection->andWhere($qb->expr()->eq('t1.' . $column, 't2.' . $column));
+ } else {
+ $selection->where($qb->expr()->eq('t1.' . $column, 't2.' . $column));
+ }
+ $i++;
}
$duplicates = $qb->executeQuery()->fetchAll(PDO::FETCH_COLUMN);