From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | John Browne <jkbrowne(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Table modifications with dependent views - best practices? |
Date: | 2005-04-22 03:26:24 |
Message-ID: | 20050422032624.GA45074@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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/
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2005-04-22 03:48:36 | Re: Regular expression. How to disable ALL meta-character |
Previous Message | Michael Fuhr | 2005-04-22 03:06:41 | Re: timezone() with timeofday() converts the wrong direction? |