Re: Broken EXPLAIN output for SubPlan in MERGE

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Broken EXPLAIN output for SubPlan in MERGE
Дата
Msg-id 202403210923.3jdsn3nic7tz@alvherre.pgsql
обсуждение исходный текст
Ответ на Broken EXPLAIN output for SubPlan in MERGE  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Список 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)



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bharath Rupireddy
Дата:
Сообщение: Re: Introduce XID age and inactive timeout based replication slot invalidation
Следующее
От: Dean Rasheed
Дата:
Сообщение: Re: MERGE ... WHEN NOT MATCHED BY SOURCE