Re: [BUGS] BUG #14621: ERROR: compressed data is corrupt
От | Lara Schembri |
---|---|
Тема | Re: [BUGS] BUG #14621: ERROR: compressed data is corrupt |
Дата | |
Msg-id | a61cac3b3a0845e5be5b71afae6afdaf@se1i0wambx002.ongame.com обсуждение исходный текст |
Ответ на | Re: [BUGS] BUG #14621: ERROR: compressed data is corrupt (Andrew Gierth <andrew@tao11.riddles.org.uk>) |
Список | pgsql-bugs |
Hi Andrew and Tom, Thanks for your reply. I tried the suggested function and it did show where the corrupted ctid is. Thanks a lot for your help. Will try this function on all tables just to see how bad the corruption is. Regards Lara -----Original Message----- From: Andrew Gierth [mailto:andrew@tao11.riddles.org.uk] Sent: den 12 april 2017 15:01 To: Tom Lane <tgl@sss.pgh.pa.us> Cc: Lara Schembri <Lara.Schembri@nyxgg.com>; pgsql-bugs@postgresql.org Subject: Re: [BUGS] BUG #14621: ERROR: compressed data is corrupt >>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes: >> Please note i have tried the chk function >> declare t text; >> begin t := $1; >> return false; >> exception when others then return true;>> end; >> which did not work. Tom> You would get better responses if you defined what you meant by Tom> "did not work", but I'm going to guess that theissue is that this Tom> code failed to expose corrupted data. That's probably because it Tom> would have just assignedthe bad datum to "t" without Tom> decompressing it. The original intended use of that function (which is one I used to give out regularly to people on IRC when working withthem on data corruption issues, and no doubt some of them have subsequently posted it on blogs or whatnot) is to passin the whole-row var for $1 like so: select ctid, id from brokentable t where chk(t); the intent being to detect failures of external toast fetches or other corruption symptoms. Unfortunately this is no longer as useful as it was, since a fix some time back now has chk(t) detoast the fields of t beforeentering the function, so the exception doesn't get caught. These days I usually have people use this one instead: create function chk(tid) returns boolean language plpgsql as $f$ declare r text; begin r := (select t from brokentablet where ctid=$1); return false; exception when others then return true; end; $f$; select ctid, id from brokentable t where chk(ctid); In both versions of the function, it's relying on the fact that everything will get detoasted and decompressed as part ofcasting the record value to text. -- Andrew (irc:RhodiumToad) -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs
В списке pgsql-bugs по дате отправления: