(2018/03/06 21:26), Etsuro Fujita wrote:
> One thing I notice while working on this is this in ExecInsert/CopyFrom,
> which I moved to ExecPrepareTupleRouting as-is for the former:
>
> /*
> * If we're capturing transition tuples, we might need to convert from the
> * partition rowtype to parent rowtype.
> */
> if (mtstate->mt_transition_capture != NULL)
> {
> if (resultRelInfo->ri_TrigDesc &&
> (resultRelInfo->ri_TrigDesc->trig_insert_before_row ||
> resultRelInfo->ri_TrigDesc->trig_insert_instead_row))
> {
> /*
> * If there are any BEFORE or INSTEAD triggers on the partition,
> * we'll have to be ready to convert their result back to
> * tuplestore format.
> */
> mtstate->mt_transition_capture->tcs_original_insert_tuple = NULL;
> mtstate->mt_transition_capture->tcs_map =
> TupConvMapForLeaf(proute, rootRelInfo, leaf_part_index);
> }
>
> Do we need to consider INSTEAD triggers here? The partition is either a
> plain table or a foreign table, so I don't think it can have those
> triggers. Am I missing something?
There seems to be no objections, so I removed the INSTEAD-trigger
condition from this. Here are updated patches for PG10 and HEAD.
Other changes:
* Add regression tests based on your test cases shown upthread
* Adjust code/comments a little bit
Best regards,
Etsuro Fujita