Fixing up a corrupted TOAST table

Today, when taking a logical backup(pg dump) of a database cluster table (PG 9.4), we saw a toast table error. pg_dump: Dumping the contents of table linkhistory failed: PQgetResult() failed. pg_dump: Error message from server: ERROR: unexpected chunk number 6 (expected 2) for toast value 1876670 in pg_toast_185452 pg_dump: The command was: COPY public.linkhistory (key,…