Previous   Next 

Dumping A Database: The Latest, Greatest, and Best Way

A patch exist for tsearch to regenerate oids when a dump file is loaded into a new database. Future versions of tsearch will not have a problem with dumping and reloading.

For now to apply the patch, download the following file to the root of your PostgreSQL source tree (not contrib/tsearch2).

http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/regprocedure_7.4.patch.gz

In the root of your PostgreSQL source tree, it's assumed that you have run configure with the options you want.

Install the patch.

gunzip regprocedure_7.4.patch.gz;
patch -b -p1 < regprocedure_7.4.patch;

Install or reinstall tsearch2 to update tsearch2.sql.

cd contrib/tsearch2;
gmake;
su;
gmake install;

Test if dumping from one database to another now works.

dropdb ts_db_a;
dropdb ts_db_b;

createdb ts_db_a;
psql ts_db_a < /usr/local/pgsql/share/contrib/tsearch2.sql;
pg_dump ts_db_a > ts_db_a.sql;

createdb ts_db_b;
psql ts_db_b < ts_db_a.sql;

psql ts_db_b

select to_tsvector('default', 'Is tsearch working?');

     to_tsvector
----------------------
 'work':3 'tsearch':2
(1 row)