| From: | shihao zhong <zhong950419(at)gmail(dot)com> |
|---|---|
| To: | Antonin Houska <ah(at)cybertec(dot)at> |
| 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-07 02:17:29 |
| Message-ID: | CAGRkXqR5cxvro6UAyqAQx2XzU54XeNwYYfP8Mwhjz5m-1hyiRA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Antonin,
> Can you please be more specific about this? I don't understand why the new
> heap has no TOAST relation in such a case.
heapam_relation_needs_toast_table() skips dropped columns. In my test
the dropped column was the only varlena one, the rest are ints. So
the old heap still has its TOAST table, and the new heap gets none:
CREATE TABLE rd (id int PRIMARY KEY, n int, b text);
ALTER TABLE rd DROP COLUMN b;
REPACK rd;
SELECT reltoastrelid FROM pg_class WHERE relname = 'rd'; -- 0
I think the function is right. The copy never carries a dropped
column's value over, so the new heap has nothing to toast. Only a
replayed change can bring one in, and then it has to fit in the page.
> Is this needed even for DELETE?
No.
In your script the live columns are too wide, so nothing can help.
Here the value belongs to a dropped column, and REPACK can drop it.
v2 clears the columns only when replaying an INSERT. restore_tuple()
and prepare_concurrent_update() stay as they are.
Thanks,
Shihao
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0002-Test-dropped-column-values-in-inserts-replayed-by.patch | application/octet-stream | 5.4 KB |
| v2-0001-Clear-out-dropped-column-values-from-inserts-repl.patch | application/octet-stream | 1.7 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Fujii Masao | 2026-10-07 02:36:59 | Re: [PATCH] pg_walsummary: suppress limit output with --quiet |
| Previous Message | Hayato Kuroda (Fujitsu) | 2026-10-07 01:56:43 | RE: [PATCH] pg_walsummary: suppress limit output with --quiet |