Re: partition routing layering in nodeModifyTable.c
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Amit Langote <amitlangote09@gmail.com>
Cc: Thomas Munro <thomas.munro@gmail.com>, David Rowley <david.rowley@2ndquadrant.com>, Robert Haas <robertmhaas@gmail.com>, Alvaro Herrera <alvherre@2ndquadrant.com>, Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>, PostgreSQL-development <pgsql-hackers@postgresql.org>, amitdkhan.pg@gmail.com
Date: 2019-08-06T23:21:33Z
Lists: pgsql-hackers
Hi, On 2019-08-05 18:16:10 +0900, Amit Langote wrote: > The patch adds a resultRelIndex field to ForeignScan node, which is > set to >= 0 value for non-SELECT queries. I first thought to set it > only if direct modification is being used, but maybe it'd be simpler > to set it even if direct modification is not used. Yea, I think we should just always set it. > To set it, the > patch teaches set_plan_refs() to initialize resultRelIndex of > ForeignScan plans that appear under ModifyTable. Fujita-san said he > plans to revise the planning of direct-modification style queries to > not require a ModifyTable node anymore, but maybe he'll just need to > add similar code elsewhere but not outside setrefs.c. I think I prefer the approach in Fujita-san's email. While not extremely pretty either, it would allow for having nodes between the foreign scan and the modify node. > > Then we could just have BeginForeignModify, BeginDirectModify, > > BeginForeignScan all be called from ExecInitForeignScan(). > > I too think that it would've been great if we could call both > BeginForeignModify and BeginDirectModify from ExecInitForeignScan, but > the former's API seems to be designed to be called from > ExecInitModifyTable from the get-go. Maybe we should leave that > as-is? Yea, we should leave it where it is. I think the API here is fairly ugly, but it's probably not worth changing. And if we were to change it, it'd need a lot bigger hammer. Greetings, Andres Freund
Commits
-
Fix initialization of es_result_relations in EvalPlanQualStart().
- 22b73d3cb0b5 14.0 landed
-
Remove PartitionRoutingInfo struct.
- fb5883da8615 14.0 landed
-
Revise child-to-root tuple conversion map management.
- 6973533650c0 14.0 landed
-
Clean up code to resolve the "root target relation" in nodeModifyTable.c
- f49b85d783f6 14.0 landed
-
Refactor code for cross-partition updates to a separate function.
- c5b097f8fa69 14.0 landed
-
Remove es_result_relation_info from EState.
- a04daa97a433 14.0 landed
-
Include result relation info in direct modify ForeignScan nodes.
- 178f2d560dde 14.0 landed
-
Create ResultRelInfos later in InitPlan, index them by RT index.
- 1375422c7826 14.0 landed