From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Broken EXPLAIN output for SubPlan in MERGE |
Date: | 2024-03-21 09:23:13 |
Message-ID: | 202403210923.3jdsn3nic7tz@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2024-Mar-12, Dean Rasheed wrote:
> While playing around with EXPLAIN and SubPlans, I noticed that there's
> a bug in how this is handled for MERGE. [...]
> However, that isn't working properly for MERGE because the inner_plan
> and inner_tlist of the corresponding deparse_namespace aren't set
> correctly. Actually the inner_tlist is correct, but the inner_plan is
> set to the ModifyTable node, whereas it needs to be the outer child
> node -- in a MERGE, any references to the source relation will be
> INNER_VAR references to the targetlist of the join node immediately
> under the ModifyTable node.
Hmm, interesting, thanks for fixing it (commit 33e729c5148c). I remember
wondering whether the nodes ought to be set differently, and now I have to
admit that this
if (((ModifyTable *) plan)->operation == CMD_MERGE)
dpns->inner_plan = outerPlan(plan);
is very funny-looking. But I didn't come up with any examples where it
mattered.
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end." (2nd Commandment for C programmers)
From | Date | Subject | |
---|---|---|---|
Next Message | Dean Rasheed | 2024-03-21 09:35:18 | Re: MERGE ... WHEN NOT MATCHED BY SOURCE |
Previous Message | Bharath Rupireddy | 2024-03-21 09:13:46 | Re: Introduce XID age and inactive timeout based replication slot invalidation |