From: Tom Lane <tgl@sss.pgh.pa.us>
To: Karsten Hilbert <Karsten.Hilbert@gmx.net>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: unexpected chunk number 2 (expected 0) for toast value ... in pg_toast_18536
Date: Sun, 15 Mar 2020 20:11:18 -0400
Message-ID: <23239.1584317478@sss.pgh.pa.us> (raw)
In-Reply-To: <20200315221433.GQ467@hermes.hilbert.loc>
References: <20200315182349.GL467@hermes.hilbert.loc>
<20200315192037.GM467@hermes.hilbert.loc>
<3b7214bd-d0b5-e66f-fd29-240f1eb56cdf@aklaver.com>
<20200315202100.GO467@hermes.hilbert.loc>
<537b5f42-efb7-6833-3c10-d2cf7cd05496@aklaver.com>
<20200315221433.GQ467@hermes.hilbert.loc>
Karsten Hilbert <Karsten.Hilbert@gmx.net> writes:
>>> According to
>>> http://www.databasesoup.com/2013/10/de-corrupting-toast-tables.html
>>> an UPDATE of the row is recommended -- should that work
>>> better than a DELETE ?
> OK, got that. What I now don't understand is how the UPDATE
> won't have to touch the TOAST table when the TOASTed value
> *is* UPDATEd:
> update blobs.doc_obj set data = '' where pk = the_faulty_row;
> (data is the BYTEA column)
It makes no sense to me either; I wonder if Josh's recipe ever
really worked? But it's clearly not working now, and that's
what I'd expect, because any mechanism for removing the busted
toast reference is going to cause the system to try to mark
the toast rows deleted.
Since you reindexed the toast table and it still doesn't find
the missing chunks, I think the easiest "fix" would be to manually
insert rows with the correct chunk_id and chunk_seq, and ideally
with chunk_data of the appropriate length. Then deletion of the
reference should work.
Unfortunately, it seems like you can't do that either, short of
hacking up the backend or writing some custom C code, because the
executor won't let you open a toast table as result relation :-(.
I wonder if we should change it to allow that when
allow_system_table_mods is true? This isn't the first time we've
seen people need to be able to do surgery on a toast table.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, Karsten.Hilbert@gmx.net
Subject: Re: unexpected chunk number 2 (expected 0) for toast value ... in pg_toast_18536
In-Reply-To: <23239.1584317478@sss.pgh.pa.us>
References: <20200315182349.GL467@hermes.hilbert.loc> <20200315192037.GM467@hermes.hilbert.loc> <3b7214bd-d0b5-e66f-fd29-240f1eb56cdf@aklaver.com> <20200315202100.GO467@hermes.hilbert.loc> <537b5f42-efb7-6833-3c10-d2cf7cd05496@aklaver.com> <20200315221433.GQ467@hermes.hilbert.loc> <23239.1584317478@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox