search_files compatibility with PostgreSQL
thl - August 25, 2009 - 21:52
| Project: | Search Files |
| Version: | 6.x-2.0-beta3 |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | thl |
| Status: | closed |
Jump to:
Description
Need to verify whether search_files is compatible to PostgreSQL. Volunteers welcome.
I'll contact you if code has been massaged enough for a first suicide attempt :-)
You have been warned! Do not try in a production environment. Always backup before try.

#1
No volunteers? So I had to experiment on myself!
see
search_files.install release 1.10.2.16
search_files.module release 1.19.2.21
search_files_attachments.module release 1.1.2.21
search_files_directories.module release 1.1.2.29
successfully tested with apache-php-5.3.0 and postgresql-8.4.0
Fixed.
#2
That DELETE fiddling broke MySQL. Showstopper for Beta4. Need to investigate.
#3
Go the following error message when opening the search settings using
latest search_files 6.x-2.x-dev (August 31, 2009 - 01:23) with Postgres 8.2 and Apache 5
* warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "AND" LINE 5: ON AND d.sid = f.fid ^ in /var/www/htdocs/includes/database.pgsql.inc on line 139.
* user warning: query: SELECT count(*) FROM files AS f LEFT JOIN search_dataset AS d ON AND d.sid = f.fid WHERE ( d.type = 'search_files_att' AND f.status = 1 AND (d.sid IS NULL OR d.reindex <> 0) ) in /var/www/htdocs/modules/search_files/search_files_attachments.module on line 75.
* warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "AND" LINE 5: ON AND d.sid = f.fid ^ in /var/www/htdocs/includes/database.pgsql.inc on line 139.
* user warning: query: SELECT count(*) FROM files AS f LEFT JOIN search_dataset AS d ON AND d.sid = f.fid WHERE ( d.type = 'search_files_att' AND f.status = 1 AND (d.sid IS NULL OR d.reindex <> 0) ) in /var/www/htdocs/modules/search_files/search_files_attachments.module on line 75.
When I run cron, files don't get indexed.
#4
It appears to be the offending "ON AND" below. Here is a quick diff.
--- search_files_attachments.module 2009-09-03 12:12:52.000000000 -0500+++ search_files_attachments.module.orig 2009-09-03 12:12:30.000000000 -0500
@@ -66,7 +66,7 @@ function search_files_attachments_search
SELECT count(*)
FROM {files} AS f
LEFT JOIN {search_dataset} AS d
- ON d.sid = f.fid
+ ON AND d.sid = f.fid
WHERE (
d.type = 'search_files_att'
AND f.status = 1
Shawn
#5
shawngo,
Your change in #4 has been committed
#6
apply shawngo fix, see
search_files_attachments.module revision 1.1.2.26
unbreak MySQL (DELETE issue), see
search_files_directories.module release 1.1.2.33
unbreak a SELECT whose compatibility modifications ended up with a syntactically correct but logically defect function, see
search_files_attachments.module revision 1.1.2.28
successfully tested with apache-2.2.13, php-5.3.0 accessing postgresql-8.4.0 and mysql-5.1.37
Fixed.
#7
Automatically closed -- issue fixed for 2 weeks with no activity.