| From: | Ewan Young <kdbase(dot)hack(at)gmail(dot)com> |
|---|---|
| To: | Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com> |
| Cc: | Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Peter Eisentraut <peter(at)eisentraut(dot)org> |
| Subject: | Re: FOR PORTION OF silently ignored on views with DO INSTEAD rules |
| Date: | 2026-09-04 04:39:59 |
| Message-ID: | CAON2xHPXds9C2OzwDDfFa4wsKM=z-J04HZqALcWNKmNDL0nT8w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Fri, Sep 4, 2026 at 11:55 AM Paul A Jungwirth
<pj(at)illuminatedcomputing(dot)com> wrote:
>
> On Thu, Sep 3, 2026 at 7:38 PM Ewan Young <kdbase(dot)hack(at)gmail(dot)com> 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 ~{:-)
> pj(at)illuminatedcomputing(dot)com
--
Regards,
Ewan Young
| From | Date | Subject | |
|---|---|---|---|
| Previous Message | Nishant Sharma | 2026-09-04 04:36:44 | Re: [PATCH] Add support for SAOP in the optimizer for partial index paths |