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.2.3 -r1.13.2.4 --- openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs-postgresql.xql 18 May 2020 20:46:41 -0000 1.13.2.3 +++ openacs-4/packages/tsearch2-driver/tcl/tsearch2-driver-procs-postgresql.xql 30 Apr 2021 17:42:53 -0000 1.13.2.4 @@ -1,14 +1,24 @@ - postgresql8.3 - insert into txt (object_id,fti) - select object_id, - setweight(to_tsvector(coalesce(:title,'')),'A') - ||setweight(to_tsvector(coalesce(:keywords,'')),'B') - ||to_tsvector(coalesce(:txt,'')) - from acs_objects where object_id = :object_id + 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 @@ -76,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