Re: Errors when update a view with conditional-INSTEAD rules

Поиск
Список
Период
Сортировка
От Dean Rasheed
Тема Re: Errors when update a view with conditional-INSTEAD rules
Дата
Msg-id CAEZATCXpFX=uGm6Aq+Dp0FCqyGKHLJ3UhF-qZ-kBDAkt+TPmtg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Errors when update a view with conditional-INSTEAD rules  (Pengzhou Tang <ptang@pivotal.io>)
Ответы Re: Errors when update a view with conditional-INSTEAD rules
Список pgsql-hackers
On Fri, 17 Jan 2020 at 06:14, Pengzhou Tang <ptang@pivotal.io> wrote:
>
> I am wondering whether a simple auto-updatable view can have a conditional update instead rule.

Well, the decision reached in [1] was that we wouldn't allow that. We
could decide to allow it now as a new feature enhancement, but it
wouldn't be a back-patchable bug-fix, and to be honest I wouldn't be
particularly excited about adding such a feature now. We already get
enough reports related to multiple rule actions behaving in
counter-intuitive ways that trip up users. I don't think we should be
enhancing the rule system, but rather encouraging users not to use it
and use triggers instead.

> The document also says that:
> "There is a catch if you try to use conditional rules for complex view updates: there must be an unconditional
> INSTEAD rule for each action you wish to allow on the view" which makes me think a simple view can have a
> conditional INSTEAD rule. And the document is explicitly changed in commit a99c42f291421572aef2:
> -   There is a catch if you try to use conditional rules for view
> +  There is a catch if you try to use conditional rules for complex view
>
> Does that mean we should support conditional rules for a simple view?
>

No. I don't recall why that wording was changed in that commit, but I
think it's meant to be read as "complex updates on views" -- i.e., the
word "complex" refers to the complexity of the update logic, not the
complexity of the view. Nothing in that paragraph is related to
complex vs simple views, it's about complex sets of rules.

Regards,
Dean

[1] https://www.postgresql.org/message-id/25777.1352325888%40sss.pgh.pa.us



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

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: SlabCheck leaks memory into TopMemoryContext
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: Complete data erasure