Обсуждение: maintaining nested views

Поиск
Список
Период
Сортировка

maintaining nested views

От
Maximilian Tyrtania
Дата:
Quite often i find myself reluctant to nest views, because of the
maintenance issues this usually involves. As you know, you can't easily
alter the "lower level" views, because the higher level ones depend on them.
So, to add a field to a lower level view one has to:

drop view vw_lowlevel CASCADE;

create view vw_lowlevel as .....;
create view vw_highlevel as (it was);

This can be quite cumbersome if there are many high level views and i don't
want them to be altered (or at least not all of them).
I'm just wondering if maybe someone has come up with a generic solution for
this?

Max




Re: maintaining nested views

От
Tom Lane
Дата:
Maximilian Tyrtania <maximilian.tyrtania@byte-employer.de> writes:
> Quite often i find myself reluctant to nest views, because of the
> maintenance issues this usually involves. As you know, you can't easily
> alter the "lower level" views, because the higher level ones depend on them.
> So, to add a field to a lower level view one has to:

> drop view vw_lowlevel CASCADE;

As of 8.4 you can add a column via CREATE OR REPLACE VIEW without that.
        regards, tom lane