Re: Fixing up a corrupted toast table

From: Steve Atkins <steve(at)blighty(dot)com>
To: pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Fixing up a corrupted toast table
Date: 2006-03-08 23:03:46
Message-ID: 59351D58-B69F-4EED-8FF3-586BFD7B39D3@blighty.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Feb 17, 2006, at 8:27 AM, Steve Atkins wrote:

>
> On Feb 17, 2006, at 6:29 AM, Tom Lane wrote:
>
>> Steve Atkins <steve(at)blighty(dot)com> writes:
>>> pg_dump: ERROR: missing chunk number 0 for toast value 25923965
[snip]

>>
>> If that doesn't work, the standard technique for locating damaged
>> data
>> should help: find the bad row by identifying the largest N for which
>> "SELECT * FROM table LIMIT n" doesn't fail, then "SELECT ctid FROM
>> table
>> OFFSET n LIMIT 1". You may be able to delete the bad row with
>> "DELETE
>> FROM table WHERE ctid = 'value gotten above'", but I wouldn't be too
>> surprised if the DELETE gives the same error. If so, you can
>> probably
>> make it happy by inserting a dummy row into the toast table (chunk ID
>> as specified in the error, chunk sequence 0, any old data value).
>
> OK, that's what I was looking for. Thanks!

Unfortunately, postgresql is smarter than I am.

Any attempt to touch the toast table gives me:

ERROR: cannot change TOAST relation "pg_toast_17410"

If I set relkind to 'r' for the toast table, shove some fake data
in there and set it back to 't' that should do it, shouldn't it?

Cheers,
Steve

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-03-08 23:07:20 Re: Fixing up a corrupted toast table
Previous Message Dann Corbit 2006-03-08 22:59:44 Re: column type varchar(128) not null default '' vs varchar(128)