I installed 6.x.1.x-dev today on a site that uses PostgreSQL. I got an error from PostgreSQL complaining about using a character varying as a boolean on uc_option_image.install line 10:

$file_path = db_result(db_query("SELECT fid from {files} WHERE filename = '%s'
AND filepath", $default_image_name, $default_image_path));

I at first thought perhaps this was intended to look for a non-blank filepath, but then I spotted the $default_image_path at the end. I think the second part of the conditional was intended to be "AND filepath = '%'". I'll guess it hasn't been caught because most people use MySQL, and probably MySQL *does* let you use a char varying as a boolean. Patch attached.

Comments

ben coleman’s picture

Status: Active » Patch (to be ported)
ben coleman’s picture

Status: Patch (to be ported) » Needs review
ben coleman’s picture

Title: query in .install is incomplete » query in uc_option_image_install in uc_option_image.install is incorrect

Any comments on this? I don't think this is just a PostgreSQL compability problem. I don't think the above code does whatever was intended. Either the $default_image_path parameter should have been left off, or filepath is supposed to be compared to it somehow. And given that the equivalent query in uc_option_image_uninstall *does* show the comparison:

db_query("DELETE FROM {files} WHERE filename = '%s' AND filepath = '%s'", $default_image_name, $default_image_path);

I'd say the comparison should be there.

pillarsdotnet’s picture

Status: Needs review » Fixed

Patch applied to -dev.

Status: Fixed » Closed (fixed)

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