Re: non-bulk inserts and tuple routing
Amit Langote <langote_amit_f8@lab.ntt.co.jp>
From: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
To: Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2018-02-16T04:42:12Z
Lists: pgsql-hackers
Attachments
- v9-0001-During-tuple-routing-initialize-per-partition-obj.patch (text/plain) patch v9-0001
On 2018/02/16 12:41, Etsuro Fujita wrote: > (2018/02/16 10:49), Amit Langote wrote: >> I think you're right. If node->returningLists is non-NULL at all, >> ExecInitModifyTable() would've initialized the needed slot and expression >> context. I added Assert()s to that affect. > > OK, but one thing I'd like to ask is: > > + /* > + * Use the slot that would have been set up in ExecInitModifyTable() > + * for the output of the RETURNING projection(s). Just make sure to > + * assign its rowtype using the RETURNING list. > + */ > + Assert(mtstate->ps.ps_ResultTupleSlot != NULL); > + tupDesc = ExecTypeFromTL(returningList, false); > + ExecAssignResultType(&mtstate->ps, tupDesc); > + slot = mtstate->ps.ps_ResultTupleSlot; > > Do we need that assignment here? I guess mean the assignment of rowtype, that is, the ExecAssignResultType() line. On looking at this some more, it looks like we don't need to ExecAssignResultType here, as you seem to be suspecting, because we want the RETURNING projection output to use the rowtype of the first of returningLists and that's what mtstate->ps.ps_ResultTupleSlot has been set to use in the first place. So, removed the ExecAssignResultType(). Attached v9. Thanks a for the review! Regards, Amit
Commits
-
Fix parent node of WCO expressions in partitioned tables.
- d06aba240d24 11.0 landed
-
Update PartitionTupleRouting struct comment
- 364de2566514 11.0 landed
-
Be lazier about partition tuple routing.
- edd44738bc88 11.0 landed