summaryrefslogtreecommitdiff
path: root/src/include/access
diff options
context:
space:
mode:
authorAndres Freund2016-08-18 00:03:36 +0000
committerAndres Freund2016-08-18 00:03:36 +0000
commit07ef035129586ca26a713c4cd15e550dfe35e643 (patch)
tree80165becad5aa3b5e999f578cbec19aa54733ce4 /src/include/access
parentcf9b0fea5f6d1bcc9b2c66f5c30ecb04684a0919 (diff)
Fix deletion of speculatively inserted TOAST on conflict
INSERT .. ON CONFLICT runs a pre-check of the possible conflicting constraints before performing the actual speculative insertion. In case the inserted tuple included TOASTed columns the ON CONFLICT condition would be handled correctly in case the conflict was caught by the pre-check, but if two transactions entered the speculative insertion phase at the same time, one would have to re-try, and the code for aborting a speculative insertion did not handle deleting the speculatively inserted TOAST datums correctly. TOAST deletion would fail with "ERROR: attempted to delete invisible tuple" as we attempted to remove the TOAST tuples using simple_heap_delete which reasoned that the given tuples should not be visible to the command that wrote them. This commit updates the heap_abort_speculative() function which aborts the conflicting tuple to use itself, via toast_delete, for deleting associated TOAST datums. Like before, the inserted toast rows are not marked as being speculative. This commit also adds a isolationtester spec test, exercising the relevant code path. Unfortunately 9.5 cannot handle two waiting sessions, and thus cannot execute this test. Reported-By: Viren Negi, Oskari Saarenmaa Author: Oskari Saarenmaa, edited a bit by me Bug: #14150 Discussion: <20160519123338.12513.20271@wrigleys.postgresql.org> Backpatch: 9.5, where ON CONFLICT was introduced
Diffstat (limited to 'src/include/access')
-rw-r--r--src/include/access/tuptoaster.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/include/access/tuptoaster.h b/src/include/access/tuptoaster.h
index 7b5ae6245e6..011f5c19062 100644
--- a/src/include/access/tuptoaster.h
+++ b/src/include/access/tuptoaster.h
@@ -142,7 +142,7 @@ extern HeapTuple toast_insert_or_update(Relation rel,
* Called by heap_delete().
* ----------
*/
-extern void toast_delete(Relation rel, HeapTuple oldtup);
+extern void toast_delete(Relation rel, HeapTuple oldtup, bool is_speculative);
/* ----------
* heap_tuple_fetch_attr() -