Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit21b1634

Browse files
committed
Fix heap_multi_insert to set t_self field in the caller's tuples.
If tuples were toasted, heap_multi_insert didn't update the ctid on theoriginal tuples. This caused a failure if there was an after trigger(including a foreign key), on the table, and a tuple got toasted.Per off-list report and test case from Ted Phelps
1 parentb4e3633 commit21b1634

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎src/backend/access/heap/heapam.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,6 +2291,14 @@ heap_multi_insert(Relation relation, HeapTuple *tuples, int ntuples,
22912291
CacheInvalidateHeapTuple(relation,heaptuples[i],NULL);
22922292
}
22932293

2294+
/*
2295+
* Copy t_self fields back to the caller's original tuples. This does
2296+
* nothing for untoasted tuples (tuples[i] == heaptuples[i)], but it's
2297+
* probably faster to always copy than check.
2298+
*/
2299+
for (i=0;i<ntuples;i++)
2300+
tuples[i]->t_self=heaptuples[i]->t_self;
2301+
22942302
pgstat_count_heap_insert(relation,ntuples);
22952303
}
22962304

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp