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
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

thl - August 30, 2009 - 17:49
Status:postponed (maintainer needs more info)» fixed

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

thl - August 30, 2009 - 22:30
Priority:normal» critical
Status:fixed» needs work

That DELETE fiddling broke MySQL. Showstopper for Beta4. Need to investigate.

#3

Thomas_M - September 2, 2009 - 15:06

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

shawngo - September 3, 2009 - 17:16

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

jrglasgow - September 3, 2009 - 17:48

shawngo,
Your change in #4 has been committed

#6

thl - September 6, 2009 - 21:06
Priority:critical» normal
Status:needs work» fixed

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

System Message - September 20, 2009 - 21:10
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.