Problem: Upgrade mailing list archive (http://fts.postgresql.org) running OpenFTS based on tsearch v2 (old names) to new tsearch v2 (new names)
Steps:
Warning:
Don't install new tsearch before dumping your db ! It'll prevent you dumping columns of type txtidx.
DB=mailware for table in `psql $DB -P tuples_only -c "\dtsv" | awk '{print $3}'` ; do echo Dumping $table ... >&2 pg_dump -s -t $table $DB >> $DB.sql done
pg_dump -a -t $table $DB >> $DB.dump
psql mailware < /usr/local/pgsql/share/contrib/tsearch.sql psql mailware < /usr/local/pgsql/share/contrib/_int.sql psql mailware < /usr/local/pgsql/share/contrib/btree_gist.sql
psql -d mailware -c "grant select on table pg_ts_cfg,pg_ts_cfgmap,pg_ts_dict,pg_ts_parser to PUBLIC;"
psql -d mailware < mailware.sql
psql -d mailware < mailware.dump
psql -d mailware -c "vacuum full analyze;"
Actually, I needed extra steps, because I install new tsearch before dumping database. This mistake prevent me dumping messages.fts_index of type txtidx, so I had to drop this column before dumping data.
Extra steps:
mailware# alter table messages drop column fts_index;
mailware# alter table messages add column fts_index tsvector;
mailware# update messages set fts_index=setweight( to_tsvector(title,'A') || to_tsvector(body);
Also, don't forget to upgrade OpenFTS itself (you need v.0.35 to work with new tsearch, available from OpenFTS CVS.
If you run OpenFTS based on old tsearch (v1) you need to modify your software to change contains operator ## to @@ to_tsquery($query).