On Fri, Sep 4, 2026 at 11:55 AM Paul A Jungwirth
<[email protected]> wrote:
>
> On Thu, Sep 3, 2026 at 7:38 PM Ewan Young <[email protected]> wrote:
> >
> > > On the other hand a DO INSTEAD NOTHING rule is allowed. Ewan's patch
> > > also allows DO INSTEAD NOTHING. That makes sense to me. Here is a
> > > revised patch adding it to Ewan's tests.
> >
> > One small thing: the new test cases use "do nothing", which the grammar
> > treats as DO ALSO NOTHING (opt_instead defaults to ALSO), so those rules
> > don't replace the query and FOR PORTION OF keeps working through the
> > auto-updatable path.  An actual unqualified "do instead nothing" rule
> > sets the instead flag in fireRules(), so the patch rejects it with the
> > same error, for both UPDATE and DELETE.  I think that is fine and
> > consistent with the ON CONFLICT precedent you mention, but the test
> > comment and the last paragraph of the commit message say the opposite,
> > so they should be adjusted one way or the other.  (Also, the second
> > "do nothing" rule says "on update" where "on delete" was intended.)
>
> Oh, good catch! I've updated the test. Even with "DO INSTEAD NOTHING",
> ON CONFLICT does allow the rule. I think this is important, since DO
> INSTEAD NOTHING has a somewhat special role as a fallback when there
> are other conditional rules.[0] So I'd like to make FOR PORTION OF
> work the same way. Making the fixed test pass required a very small
> code change. Here is a v3 with those edits.

Thanks.  Agreed, and checking product_queries != NIL matches the ON
CONFLICT check in the same function, so DO INSTEAD NOTHING stays a
no-op while any INSTEAD rule with a real action is rejected.

v3 looks good to me.

>
> [0] https://www.postgresql.org/docs/current/sql-createrule.html
>
> Yours,
>
> --
> Paul              ~{:-)
> [email protected]



-- 
Regards,
Ewan Young


Reply via email to