From: | Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> |
---|---|
To: | Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp> |
Cc: | Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Oddity in tuple routing for foreign partitions |
Date: | 2018-04-18 05:44:01 |
Message-ID: | f970d875-9711-b8cb-f270-965fa3e40334@lab.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2018/04/17 16:41, Etsuro Fujita wrote:
> In the INSERT/COPY-tuple-routing case, as explained by Amit, the
> RTE at that position in the EState's range table is the one for the
> partitioned table of a given partition, so the statement would be true.
> BUT in the UPDATE-tuple-routing case, the RTE is the one for the given
> partition, not for the partitioned table, so the statement would not be
> true. In the latter case, we don't need to create a child RTE and replace
> the original RTE with it, but I handled both cases the same way for
> simplicity.
Oh, I didn't really consider this part carefully. That the resultRelInfo
received by BeginForeignInsert (when called by ExecInitRoutingInfo) could
be a reused UPDATE result relation. It might be possible to justify the
parent_rte/child_rte terminology by explaining it a bit better. I see
three cases that arise during tuple routing:
1. This is INSERT and so the resultRelation that's received in
BeginForeignInsert has been freshly created in ExecInitPartitionInfo
and it bears node->nominalRelation or 1 as its ri_RangeTableIndex
2. This is UPDATE and the resultRelInfo that's received in
BeginForeignInsert has been freshly created in ExecInitPartitionInfo
and it bears node->nominalRelation or 1 as its ri_RangeTableIndex
3. This is UPDATE and the resultRelInfo that's received in
BeginForeignInsert is a reused one, in which case, it bears the planner
assigned ri_RangeTableIndex
In all three cases, I think we can rely on using ri_RangeTableIndex to
fetch a valid "parent" RTE from es_range_table.
Do you think we need to clarify this in a comment?
Thanks,
Amit
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2018-04-18 06:22:40 | Double-writes, take two? |
Previous Message | Thomas Munro | 2018-04-18 05:04:17 | Re: Excessive PostmasterIsAlive calls slow down WAL redo |