Re: Errors when update a view with conditional-INSTEAD rules - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: Errors when update a view with conditional-INSTEAD rules
Date
Msg-id CAEZATCXpFX=uGm6Aq+Dp0FCqyGKHLJ3UhF-qZ-kBDAkt+TPmtg@mail.gmail.com
Whole thread Raw
In response to Re: Errors when update a view with conditional-INSTEAD rules  (Pengzhou Tang <ptang@pivotal.io>)
Responses Re: Errors when update a view with conditional-INSTEAD rules
List 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 by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: SlabCheck leaks memory into TopMemoryContext
Next
From: Stephen Frost
Date:
Subject: Re: Complete data erasure