@@ -632,12 +632,6 @@ PathmanCopyFrom(CopyState cstate, Relation parent_rel,
632632if (tuple_oid != InvalidOid )
633633HeapTupleSetOid (tuple ,tuple_oid );
634634
635- /*
636- * Constraints might reference the tableoid column, so initialize
637- * t_tableOid before evaluating them.
638- */
639- tuple -> t_tableOid = RelationGetRelid (child_result_rel -> ri_RelationDesc );
640-
641635/* Place tuple in tuple slot --- but slot shouldn't free it */
642636slot = myslot ;
643637ExecStoreTuple (tuple ,slot ,InvalidBuffer , false);
@@ -661,6 +655,12 @@ PathmanCopyFrom(CopyState cstate, Relation parent_rel,
661655child_result_rel = rri_holder -> result_rel_info ;
662656estate -> es_result_relation_info = child_result_rel ;
663657
658+ /*
659+ * Constraints might reference the tableoid column, so initialize
660+ * t_tableOid before evaluating them.
661+ */
662+ tuple -> t_tableOid = RelationGetRelid (child_result_rel -> ri_RelationDesc );
663+
664664/* If there's a transform map, rebuild the tuple */
665665if (rri_holder -> tuple_map )
666666{