Concurrent REPACK: Clear out dropped-column values from all tuples

Commit e5d25959cf87 made REPACK null-out values of dropped columns in
the NEW tuple of an UPDATE.  However, a concurrent INSERT can carry one
too, for example when a trigger returns a copy of an existing row.
REPACK (CONCURRENTLY) then kept the values for such columns, which is
wasteful -- or worse, failed with "row is too big" if the new heap
happens not to have a TOAST table.

Move their clearing from prepare_concurrent_update() to restore_tuple()
so that it affects all tuples processed, not just the UPDATE ones.

Author: Shihao Zhong <[email protected]>
Backpatch-through: 19
Discussion: 
https://postgr.es/m/CAJgoLkK2UBzB1J9buCsSUbjf7bOqz-o_0=ceitruu789bhb...@mail.gmail.com

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d65fa2e72636920aa0f75518520e4aeb130841b0

Modified Files
--------------
src/backend/commands/repack.c                      | 33 +++++++++++-----------
.../injection_points/expected/repack_dropped.out   |  8 ++++--
.../injection_points/specs/repack_dropped.spec     | 16 ++++++++++-
3 files changed, 37 insertions(+), 20 deletions(-)

Reply via email to