idea: storing view source in system catalogs

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема idea: storing view source in system catalogs
Дата
Msg-id b42b73150805201103v52b53a05rdd7029dce79d4c2c@mail.gmail.com
обсуждение исходный текст
Ответы Re: idea: storing view source in system catalogs  (David Fetter <david@fetter.org>)
Re: idea: storing view source in system catalogs  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
I wonder if there is any merit to the idea of storing the 'create
view' statement that created the view in an appropriate place.  There
are basically two reasons for this:

*) preserve initial formatting, etc.
Database functions when viewed with \df+ in psql appear nice and clean
as I wrote them.  Much better than \d <view>
*) store what the view intends to do, not what it does.

If I do:
create view v as select * from foo;

The view definition as understood by the database expands the column
list.  This has unfortunately means that the view definition is no
longer valid if the underlying type changes.  Understandably, select *
is often considered bad style but nevertheless often comes up when
writing 'advanced' type manipulation that postgresql is so good at.
This also comes up when expanding composite type for example.

The idea here is to provide a stepping stone towards allowing the view
to be redefined against source objects during invalidation events.
ISTM the easiest and best way to do that is to try and reapply the
original definition against the altered dependant objects and throw
the resultant error, if any.  Views can be a real pain to deal with
than functions in terms of DDL operations.

merlin


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

Предыдущее
От: Greg Smith
Дата:
Сообщение: Re: triggers on prepare, commit, rollback... ?
Следующее
От: Sam Mason
Дата:
Сообщение: Re: triggers on prepare, commit, rollback... ?