| From: | Kirill Reshke <reshkekirill(at)gmail(dot)com> |
|---|---|
| To: | jian he <jian(dot)universality(at)gmail(dot)com> |
| Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org> |
| Subject: | Re: DELETE/UPDATE FOR PORTION OF with rule system is not working |
| Date: | 2026-04-13 15:10:17 |
| Message-ID: | CALdSSPianurospT5damYm2W30=3QbT1U45fau3HHDcn8Tb2LxA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, 13 Apr 2026 at 14:01, jian he <jian(dot)universality(at)gmail(dot)com> wrote:
>
> hi.
> Actually it's supported.
>
> The issue mentioned in the first email is caused by:
> https://git.postgresql.org/cgit/postgresql.git/commit/?id=8e72d914c52876525a90b28444453de8085c866f
> https://git.postgresql.org/cgit/postgresql.git/diff/src/backend/nodes/nodeFuncs.c?id=8e72d914c52876525a90b28444453de8085c866f
>
> --- a/src/backend/nodes/nodeFuncs.c
> +++ b/src/backend/nodes/nodeFuncs.c
> @@ -2579,6 +2579,20 @@ expression_tree_walker_impl(Node *node,
> return true;
> }
> break;
> + case T_ForPortionOfExpr:
> + {
> + ForPortionOfExpr *forPortionOf = (ForPortionOfExpr *) node;
> +
> + if (WALK(forPortionOf->targetFrom))
> + return true;
> + if (WALK(forPortionOf->targetTo))
> + return true;
> + if (WALK(forPortionOf->targetRange))
> + return true;
> + if (WALK(forPortionOf->overlapsExpr))
> + return true;
> + }
> + break;
>
> We forgot to WALK (expression_tree_walker_impl)
> ForPortionOfExpr->rangeVar and ForPortionOfExpr->rangeTargetList.
> We need to WALK those two fields of ForPortionOfExpr in
> rewriteRuleAction (ChangeVarNodes,
> ReplaceVarsFromTargetList, etc.), and maybe elsewhere.
>
> i am surprised that nothing else has broken because of this.
>
>
>
> --
> jian
> https://www.enterprisedb.com/
This fix looks valid for me.
Also, are all 4 new test cases really needed? If yes, why are we
missing ON DELETE TO ... DO INSTEAD INSERT ?
--
Best regards,
Kirill Reshke
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kirill Reshke | 2026-04-13 15:13:48 | Re: DELETE/UPDATE FOR PORTION OF with rule system is not working |
| Previous Message | Alexander Pyhalov | 2026-04-13 15:09:06 | Re: Asynchronous MergeAppend |