PostgreSQL uses double quotes to escape table and column names so using double quotes around strings is not a good idea. These fail on PostgreSQL
db_query('INSERT INTO {search_files_helpers} VALUES(NULL, "%s", "%s", "%s")', "PDF", "pdf", "/usr/bin/env pdftotext %file% -");
db_query('INSERT INTO {search_files_helpers} VALUES(NULL, "%s", "%s", "%s")', "Text", "txt", "/usr/bin/env cat %file%");
Should be
db_query("INSERT INTO {search_files_helpers} VALUES(NULL, '%s', '%s', '%s')", "PDF", "pdf", "/usr/bin/env pdftotext %file% -");
db_query("INSERT INTO {search_files_helpers} VALUES(NULL, '%s', '%s', '%s')", "Text", "txt", "/usr/bin/env cat %file%");
Now that search files is becoming an api, other modules are starting to use it. more the reason to have good support.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 494890.patch | 1.98 KB | jhodgdon |
Comments
Comment #1
jhodgdonHere is a patch against the 6.2 branch of Search Files. I only patched the Search Files API module. I have tested that it still installs and uninstalls fine under MySQL -- hopefully someone who has PostgreSQL can test on that platform?
Comment #2
jhodgdonAnd by the way, although the patch only affects the .install file, I did look at the .module file, and there doesn't appear to be any quote problem there.
Comment #3
josh waihi commentedI like it.
Comment #4
jhodgdonIs there some way we could get this fix into Search Files HEAD, and then into a Beta or RC release sometime soon? I am hoping to use Search Files API as a dependency of a new version of my Search by Page module, and it is holding me up that Search Files API cannot be installed on PostgreSQL. (see #460942: Add file indexing support.)
Thanks!
Comment #5
thl commentedFixed in 6.x-2.0-beta2, see name space and visible text cleanup: SQL statement unification ...
Won't fix 6.x-1.x which currently occupies HEAD
Comment #6
jhodgdonExcellent - thanks very much!