- Notifications
You must be signed in to change notification settings - Fork5
Commit94bc307
committed
Fix deletion of speculatively inserted TOAST on conflict
INSERT .. ON CONFLICT runs a pre-check of the possible conflictingconstraints before performing the actual speculative insertion. In casethe inserted tuple included TOASTed columns the ON CONFLICT conditionwould be handled correctly in case the conflict was caught by thepre-check, but if two transactions entered the speculative insertionphase at the same time, one would have to re-try, and the code foraborting a speculative insertion did not handle deleting thespeculatively inserted TOAST datums correctly.TOAST deletion would fail with "ERROR: attempted to delete invisibletuple" as we attempted to remove the TOAST tuples usingsimple_heap_delete which reasoned that the given tuples should not bevisible to the command that wrote them.This commit updates the heap_abort_speculative() function which abortsthe conflicting tuple to use itself, via toast_delete, for deletingassociated TOAST datums. Like before, the inserted toast rows are notmarked as being speculative.This commit also adds a isolationtester spec test, exercising therelevant code path. Unfortunately 9.5 cannot handle two waitingsessions, and thus cannot execute this test.Reported-By: Viren Negi, Oskari SaarenmaaAuthor: Oskari Saarenmaa, edited a bit by meBug: #14150Discussion: <20160519123338.12513.20271@wrigleys.postgresql.org>Backpatch: 9.5, where ON CONFLICT was introduced1 parentde396a1 commit94bc307
File tree
4 files changed
+20
-13
lines changed- src
- backend
- access/heap
- utils/time
- include/access
4 files changed
+20
-13
lines changedLines changed: 8 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3112 | 3112 |
| |
3113 | 3113 |
| |
3114 | 3114 |
| |
3115 |
| - | |
| 3115 | + | |
3116 | 3116 |
| |
3117 | 3117 |
| |
3118 | 3118 |
| |
| |||
5723 | 5723 |
| |
5724 | 5724 |
| |
5725 | 5725 |
| |
5726 |
| - | |
| 5726 | + | |
| 5727 | + | |
5727 | 5728 |
| |
5728 | 5729 |
| |
5729 | 5730 |
| |
| |||
5767 | 5768 |
| |
5768 | 5769 |
| |
5769 | 5770 |
| |
5770 |
| - | |
| 5771 | + | |
5771 | 5772 |
| |
5772 | 5773 |
| |
5773 | 5774 |
| |
| |||
5837 | 5838 |
| |
5838 | 5839 |
| |
5839 | 5840 |
| |
5840 |
| - | |
| 5841 | + | |
| 5842 | + | |
| 5843 | + | |
| 5844 | + | |
5841 | 5845 |
| |
5842 | 5846 |
| |
5843 | 5847 |
| |
|
Lines changed: 9 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
66 | 66 |
| |
67 | 67 |
| |
68 | 68 |
| |
69 |
| - | |
| 69 | + | |
70 | 70 |
| |
71 | 71 |
| |
72 | 72 |
| |
| |||
459 | 459 |
| |
460 | 460 |
| |
461 | 461 |
| |
462 |
| - | |
| 462 | + | |
463 | 463 |
| |
464 | 464 |
| |
465 | 465 |
| |
| |||
506 | 506 |
| |
507 | 507 |
| |
508 | 508 |
| |
509 |
| - | |
| 509 | + | |
510 | 510 |
| |
511 | 511 |
| |
512 | 512 |
| |
| |||
1062 | 1062 |
| |
1063 | 1063 |
| |
1064 | 1064 |
| |
1065 |
| - | |
| 1065 | + | |
1066 | 1066 |
| |
1067 | 1067 |
| |
1068 | 1068 |
| |
| |||
1654 | 1654 |
| |
1655 | 1655 |
| |
1656 | 1656 |
| |
1657 |
| - | |
| 1657 | + | |
1658 | 1658 |
| |
1659 | 1659 |
| |
1660 | 1660 |
| |
| |||
1703 | 1703 |
| |
1704 | 1704 |
| |
1705 | 1705 |
| |
1706 |
| - | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
1707 | 1710 |
| |
1708 | 1711 |
| |
1709 | 1712 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
408 | 408 |
| |
409 | 409 |
| |
410 | 410 |
| |
411 |
| - | |
412 |
| - | |
| 411 | + | |
| 412 | + | |
413 | 413 |
| |
414 | 414 |
| |
415 | 415 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
142 | 142 |
| |
143 | 143 |
| |
144 | 144 |
| |
145 |
| - | |
| 145 | + | |
146 | 146 |
| |
147 | 147 |
| |
148 | 148 |
| |
|
0 commit comments
Comments
(0)