From 4ff5f220652e8a2bdb20ce3c6b3958ac7f6e312d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Herrera?= Date: Wed, 30 Sep 2026 13:37:34 +0200 Subject: [PATCH 1/2] Clear out values from dropped columns Reported-by: Radim Marek Discussion: https://postgr.es/m/CAJgoLkK2UBzB1J9buCsSUbjf7bOqz-o_0=CeiTruU789BhBw-Q@mail.gmail.com --- src/backend/commands/repack.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/backend/commands/repack.c b/src/backend/commands/repack.c index 596c1abaf78..eadaec72d30 100644 --- a/src/backend/commands/repack.c +++ b/src/backend/commands/repack.c @@ -3017,6 +3017,9 @@ restore_tuple(BufFile *file, Relation relation, TupleTableSlot *slot) /* * Adjust 'dest' replacing any EXTERNAL_ONDISK toast pointers with the * corresponding ones from 'src'. + * + * We also take the opportunity to clear out the values in columns that were + * dropped. */ static void adjust_toast_pointers(Relation relation, TupleTableSlot *dest, TupleTableSlot *src) @@ -3029,7 +3032,10 @@ adjust_toast_pointers(Relation relation, TupleTableSlot *dest, TupleTableSlot *s varlena *varlena_dst; if (attr->attisdropped) + { + dest->tts_isnull[i] = true; continue; + } if (attr->attlen != -1) continue; if (slot_attisnull(dest, i + 1)) -- 2.47.3