Thread: BUG #17384: ERROR: missing chunk number 0 for toast value 152073604 in pg_toast_2619

BUG #17384: ERROR: missing chunk number 0 for toast value 152073604 in pg_toast_2619

From
PG Bug reporting form
Date:
The following bug has been logged on the website:

Bug reference:      17384
Logged by:          Padam Tehlan
Email address:      padam.tehlan@leptonsoftware.com
PostgreSQL version: Unsupported/Unknown
Operating system:   Windows 2012 R2
Description:

Hi,

Issue: ERROR: missing chunk number 0 for toast value 152073604 in
pg_toast_2619
we are facing issue with mentioned short description error while trying any
operation on database. 

We execute the various commands recommended in various blogs , given
below-
REINDEX table mytable;
REINDEX table pg_toast.pg_toast_40948;
VACUUM analyze mytable;

Even after successful execution of the above commands, still when execute
the Vacuum full its give error. 

Earlier response will be appreciable.

Thanks!
Padam


On Thu, Jan 27, 2022 at 08:57:28PM +0000, PG Bug reporting form wrote:
> Issue: ERROR: missing chunk number 0 for toast value 152073604 in
> pg_toast_2619
> we are facing issue with mentioned short description error while trying any
> operation on database. 
> 
> We execute the various commands recommended in various blogs , given
> below-
> REINDEX table mytable;
> REINDEX table pg_toast.pg_toast_40948;
> VACUUM analyze mytable;
> 
> Even after successful execution of the above commands, still when execute
> the Vacuum full its give error. 
> 
> Earlier response will be appreciable.

It sounds like the statistics for a catalog table are causing an error.

From my notes from a handful of years ago, I think you'll have luck doing some
things like this:

REINDEX TABLE pg_statistic;
VACUUM VERBOSE pg_statistic;
VACUUM FULL VERBOSE pg_statistic;
REINDEX INDEX pg_toast.pg_toast_2619_index;
REINDEX SCHEMA pg_toast;
REINDEX SYSTEM postgres; -- substitute the database name for postgres

BTW, what version postgres is this ?

How large are those tables?
SELECT pg_relation_size('pg_statistic'), pg_relation_size('pg_toast.pg_toast_2619_index');

-- 
Justin



Justin Pryzby <pryzby@telsasoft.com> writes:
> On Thu, Jan 27, 2022 at 08:57:28PM +0000, PG Bug reporting form wrote:
>> Issue: ERROR: missing chunk number 0 for toast value 152073604 in
>> pg_toast_2619
>> we are facing issue with mentioned short description error while trying any
>> operation on database.

> From my notes from a handful of years ago, I think you'll have luck doing some
> things like this:

The good news is that that's the toast table for pg_statistic,
which means that there is exactly no irreplaceable data in it.
If all else fails, you can just truncate pg_statistic and then
re-ANALYZE the whole database to rebuild it.

(I say "just" truncate pg_statistic, but you'll have to do that
in a standalone backend started with the -O option, else there
are permissions checks that will prevent it.)

The bad news is that there might be more corruption lurking
elsewhere.  What event precipitated this?

I think we have seen some bugs that would preferentially affect
pg_statistic, but not recently.  If you're not running a current
minor release, an update is advisable.

            regards, tom lane