Closed (fixed)
Project:
Image
Version:
6.x-1.x-dev
Component:
image.module
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
28 Mar 2005 at 04:10 UTC
Updated:
15 Mar 2007 at 18:32 UTC
Jump to comment: Most recent file
Postgres cannot take a null value when checking against an integer, such as looking for the latest image in a gallery when there are no images in the gallery. This problem can be traced to line 378 in image.module with the line $albums[$i]->latest = node_load(array('nid' => $last->nid));
A check to see if there is even an image returned should be done to make sure there are no errors in Postgres. I propose the following to replace that line:
if (isset($last->nid)) {
$albums[$i]->latest = node_load(array('nid' => $last->nid));
}
I have tested it on a prototype site running under Postgres and have no problems so far and it fixes the problem.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | image_3.patch | 1.56 KB | joe@www.joepilot.net |
Comments
Comment #1
joe@www.joepilot.net commentedI found that Postgres was throwing a bunch of errors because of db_rewrite_query adding DISTINCTS to the query. db_rewrite_query was also causing errors when viewing the albums. The order of the INNER JOIN in the query caused a relation that was referenced to not exist. The attached patch fixes that as well as the previously mentioned problems.
Comment #2
drewish commentedthat's not a valid patch so it's hard to compare to the current code but i checked and it looks like all the queries are correct now.
Comment #3
(not verified) commented