I have tried disabling the setting "Display number of comments below the thumbnail" and that helped me to work around this error. Found that trick in
http://forum.coppermine-gallery.net/index.php/topic,67596.0.htmlNow the cause of this error was an album with a nonexistent pid as thumb.
1. Found that out with a part of the debug info:
[90] => SELECT pid FROM cpg11d_pictures WHERE ((aid = '561' ) ) AND approved='YES' ORDER BY ctime DESC LIMIT 0,1 [include/functions.inc.php:1886] (0 ms)
[91] => SELECT r.pid, r.aid, filepath, filename, url_prefix, pwidth, pheight, filesize, ctime, r.title, r.keywords, r.votes, pic_rating, hits, caption, r.owner_id, pic_raw_ip, pic_hdr_ip
FROM cpg11d_pictures AS r
WHERE approved = 'YES'
AND r.pid IN (47964,47901,44615,42342,41642,41438,41277,41173) [include/functions.inc.php:1902] (1 ms)
[92] => SELECT COUNT(*) FROM cpg11d_comments WHERE pid = 47964 [include/functions.inc.php:2445] (0 ms)
[93] => SELECT COUNT(*) FROM cpg11d_comments WHERE pid = 47901 [include/functions.inc.php:2445] (0 ms)
[94] => SELECT COUNT(*) FROM cpg11d_comments WHERE pid = 44615 [include/functions.inc.php:2445] (0 ms)
[95] => SELECT COUNT(*) FROM cpg11d_comments WHERE pid = 42342 [include/functions.inc.php:2445] (0 ms)
[96] => SELECT COUNT(*) FROM cpg11d_comments WHERE pid = 41642 [include/functions.inc.php:2445] (0 ms)
[97] => SELECT COUNT(*) FROM cpg11d_comments WHERE pid = 41438 [include/functions.inc.php:2445] (0 ms)
[98] => SELECT COUNT(*) FROM cpg11d_comments WHERE pid = [include/functions.inc.php:2445] (0 ms)
[99] => DELETE FROM cpg11d_temp_messages WHERE time < 1293982187 [include/functions.inc.php:4927] (0 ms)
2. You can see a list of pids in the first query above: "AND r.pid IN (47964,47901,44615,42342,41642,41438,41277,41173) [include/functions.inc.php:1902] "
3. The eighth query from above seems wrong because of the empty "WHERE pid = " condition.
Should have been WHERE pid = 41277
4. I have checked in my database for pid 41277, this picture does not exist anymore in the table _pictures;
SELECT *
FROM `cpg11d_pictures`
WHERE `pid` = 41277;
Now to find out which album has this pid as thumbnail:
5. Query the _albums table like so:
SELECT *
FROM `cpg11d_albums`
WHERE `thumb` = 41277;
Next, edit the found record(s), set thumb=0.
Fixed!