Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Incomplete
-
11.1.2
-
None
-
None
-
Debian-based custom distro
Linux version 6.1.34-gen
Virtualized x86_64 CPU on proxmox (GenuineIntel Common KVM processor pc-i440fx-8.1 CPU @ 2.0GHz)
Nextcloud 30.0.5.1
Description
Currently my employer uses a Nextcloud based solution for groupware.
We found a bug on the files app, when after an upload, the previously updated files wouldn't show anymore. After a hard debugging time, we watered down the problem to a malfunctioning query.
The original query, as extracted from MariaDB file log, looks like this, granted the parent and storage columns change values:
SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `filecache`.`name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `filecache`.`permissions`, `checksum`, `unencrypted_size`, `metadata_etag`, `creation_time`, `upload_time`, `meta`.`json` AS `meta_json`, `meta`.`sync_token` AS `meta_sync_token` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` LEFT JOIN `oc_files_metadata` `meta` ON `filecache`.`fileid` = `meta`.`file_id` WHERE (`filecache`.`parent` = 26) AND (`storage` = 4) ORDER BY `name` ASC |
In order to investigate this, I simplified the original query to this one:
SELECT `filecache`.`fileid`,`storage`,`filecache`.`parent` FROM `oc_filecache` `filecache` WHERE (`filecache`.`parent` = 26) AND (`storage` = 4); |
For both queries, MariaDB returns empty set. However, the data IS there. When I filter either using only the parent or the storage column, the results are shown, as in the attached screenshot.
After searching a bit on the internet, I came up with the idea of doing a cast. So I've validated the following query returns the desired results:
SELECT `filecache`.`fileid`,`storage`,`filecache`.`parent` FROM `oc_filecache` `filecache` WHERE (CAST(`filecache`.`parent` AS SIGNED) = 26) AND (`storage` = 4); |
The table definition has also been attached. Both parent and storage columns are BIGINTs.
I've noticed that there are rows with the value -1 for the parent. This and the cast working makes me think there's some issue about internal type conversion.