Re: Table modifications with dependent views - best practices? - Mailing list pgsql-general

From Michael Fuhr
Subject Re: Table modifications with dependent views - best practices?
Date
Msg-id 20050422032624.GA45074@winnie.fuhr.org
Whole thread Raw
In response to Table modifications with dependent views - best practices?  (John Browne <jkbrowne@gmail.com>)
Responses Re: Table modifications with dependent views - best  ("David Roussel" <pgsql-general@diroussel.xsmail.com>)
List pgsql-general
On Thu, Apr 21, 2005 at 09:24:49PM -0500, John Browne wrote:
>
> Ok, I've been using postgres for a-while now, and am curious how you
> guys handle this.  What is the best way to make modifications to
> tables that have lots of dependent objects, like views?  Do you just
> do the obvious drop...cascade and manually re-create your views? Do
> you keep your "create view" statements in a text file for this purpose
> or just pull them from a pg_dump file?  Is there a better way to
> handle this sort of thing?

I put CREATE statements in a file so I can easily reload them.
Sometimes I put views and functions in their own files so they can
be reloaded separately, since dropping and recreating them is usually
a trivial, non-destructive operation, unlike dropping and recreating
tables.

I usually put DDL statements in a transaction, for a couple of
reasons: so that a mistake doesn't leave me with half-done work
(any error will cause the entire transaction to roll back), and to
make the changes atomic for the benefit of other transactions.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

pgsql-general by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: timezone() with timeofday() converts the wrong direction?
Next
From: Typing80wpm@aol.com
Date:
Subject: listing all tables