Обсуждение: pg_dump/pg_restore

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

pg_dump/pg_restore

От
"Sergio Gabriel Rodriguez"
Дата:
Hi for all, first sorry for my english is not good.

I'm using postgresql 7.4, I have a problem with pg_dump/pg_restore. I
want to back and restore only one schema from my db (I did it), but
when I restore it, postgresql found errors in some views, this ones
needs of others which can't be found because the script will generate
them later. How can I make an orderer sql dump???

I hope you can understand me :-).


Sergio Rodríguez (Argentina)

Re: pg_dump/pg_restore

От
Tino Schwarze
Дата:
On Tue, Apr 08, 2008 at 04:52:23PM -0300, Sergio Gabriel Rodriguez wrote:

> I'm using postgresql 7.4, I have a problem with pg_dump/pg_restore. I
> want to back and restore only one schema from my db (I did it), but
> when I restore it, postgresql found errors in some views, this ones
> needs of others which can't be found because the script will generate
> them later. How can I make an orderer sql dump???

A quick fix would be to just restore the dump multiple times -
everything which already exists will be skipped, the rest will be
loaded. Repeat until everything is fine. ;-)

Hope that helps,

Tino.

--
„Es gibt keinen Weg zum Frieden. Der Frieden ist der Weg.” (Mahatma Gandhi)

www.craniosacralzentrum.de
www.forteego.de

Re: pg_dump/pg_restore

От
Tom Lane
Дата:
"Sergio Gabriel Rodriguez" <sgrodriguez@gmail.com> writes:
> I'm using postgresql 7.4, I have a problem with pg_dump/pg_restore. I
> want to back and restore only one schema from my db (I did it), but
> when I restore it, postgresql found errors in some views, this ones
> needs of others which can't be found because the script will generate
> them later. How can I make an orderer sql dump???

Switch to a newer PG version.  If memory serves, 8.0 was the first
version in which pg_dump paid attention to dependencies rather than just
the order of original creation of views.  In 7.x it wasn't hard to
cause problems by doing CREATE OR REPLACE VIEW.

            regards, tom lane

Re: pg_dump/pg_restore

От
Andrew Sullivan
Дата:
On Tue, Apr 08, 2008 at 04:52:23PM -0300, Sergio Gabriel Rodriguez wrote:
> needs of others which can't be found because the script will generate
> them later. How can I make an orderer sql dump???

Use the custom format, use pg_restore to get the catalogue, and then edit
that catalogue to re-order the restore..

A