Re: [HACKERS] Finding corrupt data - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Finding corrupt data
Date
Msg-id 20394.945313767@sss.pgh.pa.us
Whole thread Raw
In response to Finding corrupt data  (Matthew Hagerty <matthew@venux.net>)
List pgsql-hackers
Matthew Hagerty <matthew@venux.net> writes:
> Is it possible that corrupt data could cause a backend crash?

Absolutely.  The scenario I've seen most is that the length word of a
variable-length field value (a "varlena" value in pghackers-speak)
contains garbage.  The backend comes along and tries to allocate space
equal to the claimed field length in order to copy the value to
someplace, and the usual result is that the backend process exceeds
its allowed memory usage and is summarily killed by the kernel.

> If there was corrupt data in a table, how would one go about finding it?

The brute-force way is to do a SELECT * or COPY TO and see if the
backend survives ;-).  If not, narrowing down which record is bad
is left as an exercise for the student...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Re: [BUGS] uniqueness not always correct
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] NOTICE: LockRelease: locktable lookup failed, no lock