1

After

$ pg_dumpall -U postgres -f /tmp/pgall.sql 

I see following:

pg_dump: SQL command failed
pg_dump: Error message from server: ERROR:  missing chunk number 0 for toast value 43712886 in pg_toast_16418
pg_dump: The command was: COPY public.page_parts (id, name, filter_id, content, page_id) TO stdout;
pg_dumpall: pg_dump failed on database "radiant", exiting

I haven't earlier backups. How can I fix it?

Thanks in advance.

2 Answers2

2

This means that your database is basically corrupt, for some reason.

What you need to do is try to access the table page_parts piece by piece (one row at a time), to determine which row is corrupt, and then delete the row. The probably easiest way to do this is to do a SELECT * FROM page_parts LIMIT , and do that as a binary search over the rows in the table (start at the middle, cutting each piece in half etc). Once you've identified the row, delete it, and you should be able to dump the rest of the database. Once you have the row you can also identify which individual column it is, of course, if the data is high value.

Magnus Hagander
  • 2,287
  • 15
  • 9
2

Thnx. Create simple script.

514 -- select count(*) from page_parts

for ((i=0; i<514; i++ )); do psql -U postgres radiant -c "SELECT * FROM page_parts LIMIT 1 offset $i" >/dev/null || echo $i; done

ERROR: missing chunk number 0 for toast value 43712886 in pg_toast_16418
433