Re: BUG #14150: Attempted to delete invisible tuple - Mailing list pgsql-bugs

From Peter Geoghegan
Subject Re: BUG #14150: Attempted to delete invisible tuple
Date
Msg-id CAM3SWZSf_R5g4w_md-etXyUdUtzYzWofFZ9qOzPOhbnrBUHz8A@mail.gmail.com
Whole thread Raw
In response to Re: BUG #14150: Attempted to delete invisible tuple  (Peter Geoghegan <pg@heroku.com>)
List pgsql-bugs
On Tue, Jun 7, 2016 at 7:00 PM, Peter Geoghegan <pg@heroku.com> wrote:
> So, if it's not coming from a cascading foreign key, as I suspect,
> then it's definitely coming from some other user-visible delete
> (Something that can reach heap_delete(), very probably through
> ExecDelete()). I'm very curious about what that is.

I now think it's coming through simple_heap_delete(), which in turn is
called by toast_delete_datum(). It seems likely that the
toast_delete() call in heap_abort_speculative() is how we get to
heap_delete(). So, I withdraw my remarks about it being impossible for
a "plain" ON CONFLICT DO UPDATE to reach heap_delete() (unless you
define a "plain" UPSERT as one necessarily not involving a TOAST
table).

I notice that both bug reports involve JSON documents that are
typically fairly large -- large enough to be stored externally by
TOAST. heap_abort_speculative() generally isn't called all that often,
even when there are plenty of conflicts, and UPSERTs won't usually
involve very large datums. It makes sense that it took this long to
get a bug report like this.

I'm going to work on a reproduction of the bug by modifying the
jjanes_upsert stress-testing suite. My immediate suspicion is that we
need to rethink the 9.5 changes to HeapTupleSatisfiesToast() in light
of this.

--
Peter Geoghegan

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Fwd: BUG #14181: pg_upgrade: operator family "btree_hstore_ops" does not exist
Next
From: Francisco Olarte
Date:
Subject: Re: Case in Order By Ignored without warning or error