This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| how_to:repairing_corrupted_database [2023/09/08 12:52] – [Finding the problem message] paul | how_to:repairing_corrupted_database [2024/01/15 11:35] (current) – paul | ||
|---|---|---|---|
| Line 65: | Line 65: | ||
| badid INT; | badid INT; | ||
| begin | begin | ||
| + | DROP TABLE IF EXISTS badids; | ||
| + | CREATE TEMP TABLE badids (msgdataid BIGINT); | ||
| FOR badid IN SELECT msgdataid FROM messages.msgdata ORDER BY msgdataid LOOP | FOR badid IN SELECT msgdataid FROM messages.msgdata ORDER BY msgdataid LOOP | ||
| curid = curid + 1; | curid = curid + 1; | ||
| Line 77: | Line 79: | ||
| exception | exception | ||
| when others then | when others then | ||
| + | INSERT INTO badids (msgdataid) VALUES(badid); | ||
| raise notice 'data for message % is corrupt', | raise notice 'data for message % is corrupt', | ||
| continue; | continue; | ||
| Line 88: | Line 91: | ||
| However, sometimes it won't find all problem messages, so it is a good idea to run it again after fixing any problems, until this script doesn' | However, sometimes it won't find all problem messages, so it is a good idea to run it again after fixing any problems, until this script doesn' | ||
| + | |||
| + | This script stores the bad message IDs in a temporary table called ' | ||
| ===Getting message summary info=== | ===Getting message summary info=== | ||