Re: REPACK (CONCURRENTLY) might keep dropped-column data

From: Antonin Houska <ah(at)cybertec(dot)at>
To: shihao zhong <zhong950419(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)kurilemu(dot)de>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Radim Marek <radim(at)boringsql(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: REPACK (CONCURRENTLY) might keep dropped-column data
Date: 2026-10-06 07:35:13
Message-ID: 12438.1791272113@localhost
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

shihao zhong <zhong950419(at)gmail(dot)com> wrote:

> A replayed INSERT can carry a dropped column's value too, and that
> path still stores it.
>
> A BEFORE INSERT trigger that returns a copy of
> an existing row does it:
>
> r := (SELECT t FROM demo t WHERE id = 1);
> r.id := NEW.id;
> RETURN r;
>
> So does an UPDATE that moves the row to another partition while the
> trigger returns OLD. COPY, MERGE and INSERT ON CONFLICT go the same
> way.

> It can also make REPACK fail. If the columns that are left need no
> TOAST table, the new heap has none, and on master I get:
>
> ERROR: row is too big: size 16424, maximum size 8160

Can you please be more specific about this? I don't understand why the new
heap has no TOAST relation in such a case. Perhaps a bug in see
heapam_relation_needs_toast_table()? I'm not sure it should return here,
regardless the tuple size.

if (!has_toastable_attrs)
return false; /* nothing to toast? */

> 0001 clears dropped columns in restore_tuple(), so every kind of
> change is covered, and the block added to prepare_concurrent_update()
> is no longer needed.

Is this needed even for DELETE?

--
Antonin Houska
Web: https://www.cybertec-postgresql.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexandre Felipe 2026-10-06 07:44:53 LWLock granular partition lock memory layout
Previous Message Bertrand Drouvot 2026-10-06 07:33:11 Re: Persist slot invalidations before publishing them