Обсуждение: pg_dump and tsearch2

Поиск
Список
Период
Сортировка

pg_dump and tsearch2

От
Michal Hlavac
Дата:
Hellou,

when I use
pg_dump database > dump.dat
on database with tsearch2 and then
psql database < dump.dat - this command fails, because in dump.dat is
declaration of tsearch2 procedures and types after main schema, which is
using tsearch2.

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

How Can I use this patch on cygwin???

thank you, hlavki



Re: pg_dump and tsearch2

От
Teodor Sigaev
Дата:
Yes, it's possible.

Michal Hlavac wrote:
> Hellou,
>
> when I use
> pg_dump database > dump.dat
> on database with tsearch2 and then
> psql database < dump.dat - this command fails, because in dump.dat is
> declaration of tsearch2 procedures and types after main schema, which is
> using tsearch2.
>
> is this patch for this??
> http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/regprocedure_7.4.patch.gz
>
>
> How Can I use this patch on cygwin???
>
> thank you, hlavki
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>      joining column's datatypes do not match

--
Teodor Sigaev                                  E-mail: teodor@sigaev.ru

Re: pg_dump and tsearch2

От
Michal Hlavac
Дата:
sorry for my strictness. My problem is with type tsvector.

I have table in my schema with column of tsvector type. During importing
  dump.dat (with psql database < dump.dat) postgresql returns:
ERROR:  type "tsvector" does not exist

It is because declaration of tsvector is after declaration of table with
tsvector column...

That patch is for procefures... Or there is some other problems...
I am using 7.4.2 on cygwin.

thanks, hlavki


Re: pg_dump and tsearch2

От
Tom Lane
Дата:
Michal Hlavac <hlavki@medium13.sk> writes:
> sorry for my strictness. My problem is with type tsvector.
> It is because declaration of tsvector is after declaration of table with
> tsvector column...

Right.  This typically happens when you added a tsvector column to a
table that existed before the tsvector type was created.  7.4 and before
pg_dump tend to dump the objects in creation order and so have a
problem.  (CVS tip pg_dump is smarter, but I don't know if you can/want
to use it.)

What would probably work is to load the tsearch stuff into the new
database and then restore your dump.  You'll get errors when the script
tries to load the old tsearch objects, but you can ignore them.

If you're using pg_restore, another way is to make use of the feature
pg_restore has for manual control of the restore order.

            regards, tom lane