Re: non-bulk inserts and tuple routing - Mailing list pgsql-hackers

From Amit Langote
Subject Re: non-bulk inserts and tuple routing
Date
Msg-id caf71439-fd65-864e-c441-4053430f812e@lab.ntt.co.jp
Whole thread Raw
In response to Re: non-bulk inserts and tuple routing  (Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>)
Responses Re: non-bulk inserts and tuple routing  (Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>)
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: Kyotaro HORIGUCHI
Date:
Subject: Re: Removing useless #include's.
Next
From: Kyotaro HORIGUCHI
Date:
Subject: Re: spin.c includes pg_sema.h even if unnecessary