Search Postgresql Archives

Re: Table modifications with dependent views - best practices?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux