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

From Melvin Davidson
Subject Re: How to intelligently work with views that depend on other views
Date
Msg-id CANu8FiwDmbapCc9VYiECKMtjQFX5OVN0DbLp-WU2ndUiVGC40w@mail.gmail.com
Whole thread Raw
In response to How to intelligently work with views that depend on other views  ("W. Matthew Wilson" <matt@tplus1.com>)
Responses Re: How to intelligently work with views that depend on other views
List pgsql-general
The best solution, IMHO, is don't create views that depend on other views. Although, it makes it easier in some cases, you pay the price in maintenance, as you have already found out. In addition, there is also the security problem that comes into play. EG: a user is allowed access to view c, but should not be allowed to see columns of table 1, which
are referenced by view a.

Much better to just make each view a stand alone.

On Thu, Aug 6, 2015 at 4:44 PM, W. Matthew Wilson <matt@tplus1.com> 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?

GO POSTGRESQL!


--
W. Matthew Wilson
matt@tplus1.com
http://tplus1.com


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: How to intelligently work with views that depend on other views
Next
From: Sophia Wright
Date:
Subject: Re: Strange deadlock in foreign key check