mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
amcheck: Normalize index tuples containing uncompressed varlena
It might happen that the varlena value wasn't compressed by index_form_tuple() due to current storage parameters. If compression is currently enabled, we need to compress such values to match index tuple coming from the heap. Backpatch to all supported versions. Discussion: https://postgr.es/m/flat/7bdbe559-d61a-4ae4-a6e1-48abdf3024cc%40postgrespro.ru Author: Andrey Borodin Reviewed-by: Alexander Lakhin, Michael Zhilin, Jian He, Alexander Korotkov Backpatch-through: 12
This commit is contained in:
@ -23,6 +23,7 @@
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/heaptoast.h"
|
||||
#include "access/htup_details.h"
|
||||
#include "access/nbtree.h"
|
||||
#include "access/table.h"
|
||||
@ -2981,6 +2982,18 @@ bt_normalize_tuple(BtreeCheckState *state, IndexTuple itup)
|
||||
ItemPointerGetBlockNumber(&(itup->t_tid)),
|
||||
ItemPointerGetOffsetNumber(&(itup->t_tid)),
|
||||
RelationGetRelationName(state->rel))));
|
||||
else if (!VARATT_IS_COMPRESSED(DatumGetPointer(normalized[i])) &&
|
||||
VARSIZE(DatumGetPointer(normalized[i])) > TOAST_INDEX_TARGET &&
|
||||
(att->attstorage == TYPSTORAGE_EXTENDED ||
|
||||
att->attstorage == TYPSTORAGE_MAIN))
|
||||
{
|
||||
/*
|
||||
* This value will be compressed by index_form_tuple() with the
|
||||
* current storage settings. We may be here because this tuple
|
||||
* was formed with different storage settings. So, force forming.
|
||||
*/
|
||||
formnewtup = true;
|
||||
}
|
||||
else if (VARATT_IS_COMPRESSED(DatumGetPointer(normalized[i])))
|
||||
{
|
||||
formnewtup = true;
|
||||
|
Reference in New Issue
Block a user