I'm a little worried about this.  In the pathological case you have a Gallery that has all PNG files.  Arguably this isn't any worse than the v49 upgrade path, but in my estimation the double dots was far less likely to happen.  My theory there was that no default format uses double dots, but it's conceivable that somebody has decided to never upload JPG files to their Gallery.

I think you can pare the list way down with:

```
SELECT DISTINCT(LOWER(CONCAT(parent_id, SUBSTR(name, 1, LOCATE(".", name) - 1)))) AS N,
       COUNT(*) AS C
FROM items
WHERE type <> 'album'
GROUP BY N
HAVING C > 1 
```

That should give you only the list of items that have the same base name (sans extension) and the same parent.  FWIW in my production Gallery (17k items) this query turns up nothing but your query turns up 205 entries (pretty much all of my movies).