nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.51k stars 4.08k forks source link

fix(Files): use prepare statement for path_hash in propagator #49469

Open blizzz opened 15 hours ago

blizzz commented 15 hours ago

Summary

The other day I had to analyze SQL queries. And in the log I found entries like:

UPDATE "oc_filecache" SET "mtime" = GREATEST("mtime", $1), "etag" = $2 
WHERE ("storage" = $3) 
    AND ("path_hash" IN ('0123456789abcdef0123456789abcdef', '123456789abcdef0123456789abcdef0', '23456789abcdef0123456789abcdef01', '3456789abcdef0123456789abcdef012', '456789abcdef0123456789abcdef0123', '56789abcdef0123456789abcdef01234', '6789abcdef0123456789abcdef012345', '789abcdef0123456789abcdef0123456')) 

As you see, some parameters where having placeholders (originating from use of prepared statements) while the IN list had not. So it was not possible to simply sum up this query, because it contained differing values.

Checklist