Re: How to intelligently work with views that depend on other views - Mailing list pgsql-general

From Adrian Klaver
Subject Re: How to intelligently work with views that depend on other views
Date
Msg-id 55C3E478.8000506@aklaver.com
Whole thread Raw
In response to How to intelligently work with views that depend on other views  ("W. Matthew Wilson" <matt@tplus1.com>)
List pgsql-general
On 08/06/2015 01:44 PM, W. Matthew Wilson wrote:
> I have a bunch of views, and some views use data from other views.
>
> For example, view A might get used by view B and view B gets used by view C.
>
> Several times now, as I got further into the project, I've changed how
> I make some views and I've had to redefine not just that view, but all
> the ones that depend on it.
>
> This is getting frustrating!  When I want to change how I make view A,
> I have to drop view A cascade, and then view B and view C are dropped.
>
> Then I have to remember to re-create B and C after I rewrite A.
>
> There's likely a better solution...
>
> What is it?

Use some sort of schema versioning and management tool. I have been
using Sqitch(http://sqitch.org/) and have found it very useful for this
sort of thing. There is some setup overhead, but after that going
forward and backwards in your schema management becomes fairly easy. As
a bonus you get a nice record of what you have done and if you write
good comments, why you did it:)

>
> GO POSTGRESQL!
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: "W. Matthew Wilson"
Date:
Subject: How to intelligently work with views that depend on other views
Next
From: Melvin Davidson
Date:
Subject: Re: How to intelligently work with views that depend on other views