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/