Re: Deprecating RULES

Поиск
Список
Период
Сортировка
От Hannu Krosing
Тема Re: Deprecating RULES
Дата
Msg-id 507C31B3.40803@krosing.net
обсуждение исходный текст
Ответ на Re: Deprecating RULES  (Greg Stark <stark@mit.edu>)
Список pgsql-hackers
On 10/15/2012 12:41 PM, Greg Stark wrote:
> On Mon, Oct 15, 2012 at 8:00 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
>> Please can anyone show me the SQL for a rule that cannot be written as
>> a view or a trigger? I do not believe such a thing exists and I will
>> provide free beer to the first person that can prove me wrong.
> Being written as a view doesn't help you because views use rules. I
> repeat, the very fact that we need rules to implement views prove
> rules are necessary for some purposes.
>
We really don't *need* rules to implement views as proved by other
databases which do have views but don't have rules.

Rules were used for implementing views because they were already
there and that by constraining them to standard VIEW syntax we
could nicely cut back the footgunnyness of SELECT rules (by
disallowing the "bad" usage like replacing select by insert or doing
multiple selects instead of one). Some of that is still available when
you place a VIEW over a function, but then it is at least more explicit.

-----
Hannu



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: odd alter_generic regression failures
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Truncate if exists