Re: POSS. FEATURE REQ: "Dynamic" Views

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: POSS. FEATURE REQ: "Dynamic" Views
Дата
Msg-id 1285.1125154112@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: POSS. FEATURE REQ: "Dynamic" Views  ("Jim C. Nasby" <jnasby@pervasive.com>)
Ответы Re: POSS. FEATURE REQ: "Dynamic" Views  (Chris Travers <chris@travelamericas.com>)
Re: POSS. FEATURE REQ: "Dynamic" Views  (Greg Stark <gsstark@mit.edu>)
Re: POSS. FEATURE REQ: "Dynamic" Views  (Scott Marlowe <smarlowe@g2switchworks.com>)
Список pgsql-general
"Jim C. Nasby" <jnasby@pervasive.com> writes:
>> How is this different from materialized views, which is already on the
>> TODO list?

> The idea behind the DYNAMIC VIEW is that if you made a DDL change in the
> table it could be reflected in the view. So for example, if you defined
> a view as SELECT * FROM table; and then added a field to the table that
> field would also show up in the view.

But why exactly is this a good idea?  It seems like an absolutely
horrible idea to me.  It is oft-repeated advice that you don't use
"SELECT *" ever in production programming, because your applications
will break as soon as any columns are added (or removed, even if they
don't make any use of those columns).  The proposed dynamic view
facility would move that instability of results right into the views.

What's more, I cannot see any benefit to be gained over just issuing
the expanded query directly.  You couldn't layer a normal view over
a dynamic view (not having any idea what columns it'll return), nor
even a prepared statement, because those things nail down specific
result columns too.  So it's just an awkwardly expressed form of
query macro that can only be used in interactively-issued commands.

I think the burden of proof is on the proponents of this idea to show
that it's sensible, and it doesn't deserve to be in TODO just because
one or two people think it'd be nice.

            regards, tom lane

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Postgresql Function Cookbook/General howto
Следующее
От: Tang Tim Hei
Дата:
Сообщение: A strange problem