Index: openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs-postgresql.xql,v diff -u -r1.10 -r1.10.2.1 --- openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs-postgresql.xql 2 Apr 2013 11:05:18 -0000 1.10 +++ openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs-postgresql.xql 27 Nov 2014 09:48:52 -0000 1.10.2.1 @@ -52,8 +52,7 @@ from [join $from_clauses ","] $base_query - [expr {[llength $where_clauses] > 0 ? " and " : ""}] - [join $where_clauses " and "] + [expr {[llength $where_clauses] > 0 ? " and [join $where_clauses { and }]" : ""}] order by ts_rank(fti,to_tsquery(:query)) desc ), :user_id, 'read') $limit_clause $offset_clause @@ -67,8 +66,7 @@ from [join $from_clauses ","] $base_query - [expr {[llength $where_clauses] > 0 ? " and " : ""}] - [join $where_clauses " and "] + [expr {[llength $where_clauses] > 0 ? " and [join $where_clauses { and }]" : ""}] Index: openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs.tcl,v diff -u -r1.29.2.4 -r1.29.2.5 --- openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs.tcl 21 Aug 2014 11:12:40 -0000 1.29.2.4 +++ openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs.tcl 27 Nov 2014 09:48:53 -0000 1.29.2.5 @@ -133,6 +133,10 @@ # clean up query for tsearch2 set query [tsearch2::build_query -query $query] + set where_clauses "" + set from_clauses "" + if {![info exists user_id]} {set user_id 0} + # don't use bind vars since pg7.3 yacks for '1' (which is what comes out of bind vars) set limit_clause "" set offset_clause ""