Re: pg_dump and restore - views

From: "Wang, Marcus" <Marcus(dot)Wang(at)team(dot)telstra(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: pg_dump and restore - views
Date: 2006-04-20 04:44:01
Message-ID: A0615F86CE3CBB47815DAB28CC6C651BFBF0AD@WSMSG2151V.srv.dir.telstra.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Thanks for the reply Tom. Since v8.x is not SOE yet, we can't use it for
now - as we are trying to comply with internal standards :(
As far as I know - tables are pre existing and just added views for the
new group of users.

Regards
Marcus

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Thursday, 20 April 2006 12:40 PM
To: Wang, Marcus
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: [NOVICE] pg_dump and restore - views

"Wang, Marcus" <Marcus(dot)Wang(at)team(dot)telstra(dot)com> writes:
> We've got postgresql 7.4 and a few views. I'm using pg_dump to backup
> the database and everything is ok. Recently, we added 5 new views -
> but when I restore the dump with psql, out of 5 new views, only 3 is
> recreated, 2 are missing. But when I check the dump file - those views

> are in the dump, but somehow they are not recreated. While the
> database is being restored - I've got error messages for relattioni
"view_name"
> does not exist.

Sounds to me like pg_dump is dumping the views in the wrong order, ie,
before the tables they depend on. This is a generic hazard in pre-8.0
releases. It's likely to occur any time you use CREATE OR REPLACE VIEW
to make a view refer to a table that was created after the view was
first created, because pg_dump mostly goes by creation order to
determine dump order.

Fixes: manually adjust the dump-script order (pg_restore -l can help);
drop the views entirely in the source DB, and recreate them; update to
PG 8.x which has a smarter pg_dump.

regards, tom lane

Browse pgsql-novice by date

  From Date Subject
Next Message Frances Collier 2006-04-20 15:47:36 Re: postgresql connection problems
Previous Message Tom Lane 2006-04-20 02:39:36 Re: pg_dump and restore - views