From: Arthur Schiwon Date: Mon, 3 Feb 2020 15:17:25 +0000 (+0100) Subject: for the DB ot pick an index specify the object_type X-Git-Tag: v18.0.1RC1~9^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2b82c353c89bdfb538e09535da21426548cbacc5;p=nextcloud-server.git for the DB ot pick an index specify the object_type Signed-off-by: Arthur Schiwon --- diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php index a4be8b3e4b1..f1c72243597 100644 --- a/lib/private/Comments/Manager.php +++ b/lib/private/Comments/Manager.php @@ -601,11 +601,13 @@ class Manager implements ICommentsManager { $query = $qb->select('f.fileid') ->addSelect($qb->func()->count('c.id', 'num_ids')) ->from('filecache', 'f') - ->leftJoin('f', 'comments', 'c', $qb->expr()->eq( - 'f.fileid', $qb->expr()->castColumn('c.object_id', IQueryBuilder::PARAM_INT) + ->leftJoin('f', 'comments', 'c', $qb->expr()->andX( + $qb->expr()->eq('f.fileid', $qb->expr()->castColumn('c.object_id', IQueryBuilder::PARAM_INT)), + $qb->expr()->eq('c.object_type', $qb->createNamedParameter('files')) )) - ->leftJoin('c', 'comments_read_markers', 'm', $qb->expr()->eq( - 'c.object_id', 'm.object_id' + ->leftJoin('c', 'comments_read_markers', 'm', $qb->expr()->andX( + $qb->expr()->eq('c.object_id', 'm.object_id'), + $qb->expr()->eq('m.object_type', $qb->createNamedParameter('files')) )) ->where( $qb->expr()->andX(