In drupal 6.2 with img_assist-6.x-1.0-beta1 and postgresql 8.1, I started to get an error when updating. (I didn't store the error, sorry :().

The error was when trying to run the following SQL query:
SELECT * FROM files f INNER JOIN image i WHERE f.fid = i.fid AND i.nid = 10 AND f.filename = '_original';

Which is constructed in _img_assist_remove function inside img_assist.module ($result = db_query("SELECT * FROM {files} f INNER JOIN {image} i WHERE f.fid = i.fid AND i.nid = %d AND f.filename = '%s'", $node->nid, $size['key']);).

The problem is that the SQL select is not properly coded. Should be:
* If you'd like an explicit inner join:
"SELECT * FROM {files} f INNER JOIN {image} i ON f.fid = i.fid AND i.nid = %d AND f.filename = '%s'"

* If you'd like to do it in an implicit way:
"SELECT * FROM {files} f, {image} i WHERE f.fid = i.fid AND i.nid = %d AND f.filename = '%s'"

The problem is that in current version (also in cvs) the query is wrong.

I cannot reproduce it since I did a rollback to drupal 5.7. But I think the bug is pretty isolated :)

Comments

sun’s picture

Status: Active » Postponed (maintainer needs more info)

I don't understand what's the actual bug in your report. Would you mind to create a patch? See http://drupal.org/patch/create for further information.

bursalia2k’s picture

StatusFileSize
new903 bytes

Sorry, I was a bit in a hurry at work :( Here you have the patch. Hope will help.

sun’s picture

Version: 6.x-1.x-dev » 6.x-1.0-beta1
Status: Postponed (maintainer needs more info) » Needs review

Looks good. We should check the other queries, too.

sun’s picture

Status: Needs review » Fixed

Committed along with some other SQL query fixes.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.