You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Column 'file_id' in WHERE is ambiguous in PreviewMapper::getByFileId() #63250
After upgrading to Nextcloud 34.0.3 the command occ preview:pre-generate (from the Preview Generator app) fails with:
SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'file_id' in WHERE is ambiguous
Steps to reproduce
Install / upgrade to Nextcloud 34.0.3
Have the Preview Generator app (5.14.0) enabled
Run:
sudo -u www-data php occ preview:pre-generate
The command crashes with the ambiguous column error.
Cause
In lib/private/Preview/Db/PreviewMapper.php the method getByFileId() still uses an unqualified column name:
public function getByFileId(int $fileId): \Generator {
$selectQb = $this->db->getQueryBuilder();
$this->joinLocation($selectQb)
->where($selectQb->expr()->eq('file_id', $selectQb->createNamedParameter($fileId, IQueryBuilder::PARAM_INT)));
yield from $this->yieldEntities($selectQb);
}
joinLocation() performs a LEFT JOIN on preview_versions (alias v), which also contains a file_id column.
The other methods in the same class (getAvailablePreviewsForFile, getAvailablePreviews) correctly use the alias p.file_id.
Activity
amessina commentedon Aug 14, 2026
Same result with PostgreSQL.
Also related #63229.
joshtrichards commentedon Aug 14, 2026
Agreed. Covered as the second matter in #63229 so I'll close as a duplicate. Feel free to send in a PR.