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.13 -r1.14 --- openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs-postgresql.xql 7 Nov 2017 09:33:21 -0000 1.13 +++ openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs-postgresql.xql 3 Sep 2024 15:37:54 -0000 1.14 @@ -1,13 +1,24 @@ - postgresql8.3 - insert into txt (object_id,fti) - values (:object_id, - setweight(to_tsvector(coalesce(:title,'')),'A') - ||setweight(to_tsvector(coalesce(:keywords,'')),'B') - ||to_tsvector(coalesce(:txt,''))) + with index as ( + select setweight(to_tsvector(coalesce(:title,'')),'A') + ||setweight(to_tsvector(coalesce(:keywords,'')),'B') + ||to_tsvector(coalesce(:txt,'')) as fti + from dual + ), + insert as ( + insert into txt (object_id, fti) + select o.object_id, i.fti + from acs_objects o, index i + where object_id = :object_id + and not exists (select 1 from txt + where object_id = o.object_id) + ) + update txt set + fti = (select fti from index) + where object_id = :object_id @@ -58,7 +69,7 @@ postgresql8.4 - select count(distinct(orig_object_id)) from acs_permission__permission_p_recursive_array(array( + select count(distinct(orig_object_id)) from acs_permission.permission_p_recursive_array(array( select txt.object_id from [join $from_clauses ","] $base_query @@ -75,17 +86,6 @@ - - postgresql8.3 - - update txt set fti = - setweight(to_tsvector(coalesce(:title,'')),'A') - ||setweight(to_tsvector(coalesce(:keywords,'')),'B') - ||to_tsvector(coalesce(:txt,'')) - where object_id=:object_id - - - postgresql8.2