diff options
Diffstat (limited to 'src/backend')
| -rw-r--r-- | src/backend/commands/copy.c | 3 | ||||
| -rw-r--r-- | src/backend/executor/execIndexing.c | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index eca0be1ff96..2593732c16e 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -2446,6 +2446,9 @@ CopyMultiInsertBufferFlush(CopyMultiInsertInfo *miinfo, ResultRelInfo *resultRelInfo = buffer->resultRelInfo; TupleTableSlot **slots = buffer->slots; + /* Set es_result_relation_info to the ResultRelInfo we're flushing. */ + estate->es_result_relation_info = resultRelInfo; + /* * Print error context information correctly, if one of the operations * below fail. diff --git a/src/backend/executor/execIndexing.c b/src/backend/executor/execIndexing.c index c41c5f45e7e..40bd8049f05 100644 --- a/src/backend/executor/execIndexing.c +++ b/src/backend/executor/execIndexing.c @@ -299,6 +299,9 @@ ExecInsertIndexTuples(TupleTableSlot *slot, indexInfoArray = resultRelInfo->ri_IndexRelationInfo; heapRelation = resultRelInfo->ri_RelationDesc; + /* Sanity check: slot must belong to the same rel as the resultRelInfo. */ + Assert(slot->tts_tableOid == RelationGetRelid(heapRelation)); + /* * We will use the EState's per-tuple context for evaluating predicates * and index expressions (creating it if it's not already there). |
