From: | "Merlin Moncure" <mmoncure(at)gmail(dot)com> |
---|---|
To: | "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com> |
Cc: | "Ed L(dot)" <pgsql(at)bluepolka(dot)net>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: view management |
Date: | 2007-11-16 21:18:20 |
Message-ID: | b42b73150711161318t26ef4ff9i62b536ce0b9d423@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Nov 16, 2007 4:01 PM, Joshua D. Drake <jd(at)commandprompt(dot)com> wrote:
> On Fri, 16 Nov 2007 13:57:24 -0700
> "Ed L." <pgsql(at)bluepolka(dot)net> wrote:
>
> > I have a question about view management...
> >
> > I often have need for views that reference views that reference
> > views, and so on. When I need to make a small update to one of
> > the views, I am faced with having to drop and recreate all
> > dependent views even if the driving change just adds another
> > column to the view, for example. I might have to drop and
> > recreate many tens of views just to make a change to a single
> > view. What a PITA. How do others manage this?
>
> I use stored procedures instead.
IMO, this approach has a lot of problems...not only does it force you
to think of your database access in terms of inputs and outputs in
advance. Furthermore it can force your queries using the functions
into awkward or suboptimal plans. I think functions are appropriate
for certain tasks that are better handled in procedural manner for
various reasons, but it's very good style to keep applications
interfacing to the database as much as possible through views. All
procedure access is ok, but is too much abstraction and creates
headaches down the line. Furthermore, it hides the problem asked by
the OP, not solves it, since the database merely forces you to check
the dependencies by creating the view, whereas functions displace that
check down the line which might result in missed dependency issues.
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2007-11-16 21:32:43 | Re: [GENERAL] [pgtranslation-translators] Call for translations |
Previous Message | Scott Marlowe | 2007-11-16 21:18:14 | Re: PostgreSQL - Services delivery query ? |