Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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.


-----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
> 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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group