Re: view management

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: view management
Дата
Msg-id b42b73150711161318t26ef4ff9i62b536ce0b9d423@mail.gmail.com
обсуждение исходный текст
Ответ на Re: view management  ("Joshua D. Drake" <jd@commandprompt.com>)
Список pgsql-general
On Nov 16, 2007 4:01 PM, Joshua D. Drake <jd@commandprompt.com> wrote:
> On Fri, 16 Nov 2007 13:57:24 -0700
> "Ed L." <pgsql@bluepolka.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

В списке pgsql-general по дате отправления:

Предыдущее
От: "Scott Marlowe"
Дата:
Сообщение: Re: [ADMIN] PostgreSQL - Services delivery query ?
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: convert access sql to postgresql