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

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Radim Marek <radim(at)boringsql(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "ah(at)cybertec(dot)at" <ah(at)cybertec(dot)at>
Subject: Re: REPACK (CONCURRENTLY) might keep dropped-column data
Date: 2026-09-30 11:48:05
Message-ID: arz09-sHiSl3qBN0@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Radim, thanks for testing!

On 2026-Sep-30, Radim Marek wrote:

> Aha, so on my way to office I started thinking and got more silly ideas,
> and now can confirm this is more widespread than logical subscriber use
> case.

Oh, thanks for the simplified test case. We can fix this easily by
setting the column to null in the tuple to write out, as in the attached
patch. The adjust_toast_pointers() function should perhaps be renamed,
and the comment rewritten, since it's no longer just about toast ...
I didn't do that though.

I put together a crude test case to verify with isolationtester.
Without the fix, this reproduces the bloat you saw; with the fix, the
toast table's size after the repack is zero. This needs some more
boiling before being committable, but it suffices to show the problem.

Regards

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"The Gord often wonders why people threaten never to come back after they've
been told never to return" (www.actsofgord.com)

Attachment Content-Type Size
0001-Clear-out-values-from-dropped-columns.patch text/x-diff 1.3 KB
0002-Crude-test-case.patch text/x-diff 1.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2026-09-30 11:59:25 Re: [PATCH v1] Fix out-of-bounds access in pg_bsd_indent's parser stack
Previous Message Heikki Linnakangas 2026-09-30 11:43:21 Re: [PATCH] Two remaining shmem attachment issues in single-user mode