Perform a lot more sanity checks when freezing tuples.

Andres Freund <andres@anarazel.de>

Commit: 986a9153b9708071adf6ce2c9131266f3431f4ec
Author: Andres Freund <andres@anarazel.de>
Date: 2017-12-15T02:20:48Z
Releases: 9.6.7
Perform a lot more sanity checks when freezing tuples.

The previous commit has shown that the sanity checks around freezing
aren't strong enough. Strengthening them seems especially important
because the existance of the bug has caused corruption that we don't
want to make even worse during future vacuum cycles.

The errors are emitted with ereport rather than elog, despite being
"should never happen" messages, so a proper error code is emitted. To
avoid superflous translations, mark messages as internal.

Author: Andres Freund and Alvaro Herrera
Reviewed-By: Alvaro Herrera, Michael Paquier
Discussion: https://postgr.es/m/20171102112019.33wb7g5wp4zpjelu@alap3.anarazel.de
Backpatch: 9.3-

Files

Discussion