| From: | shihao zhong <zhong950419(at)gmail(dot)com> |
|---|---|
| To: | Alvaro Herrera <alvherre(at)kurilemu(dot)de> |
| Cc: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Radim Marek <radim(at)boringsql(dot)com>, Antonin Houska <ah(at)cybertec(dot)at>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: REPACK (CONCURRENTLY) might keep dropped-column data |
| Date: | 2026-10-05 15:46:54 |
| Message-ID: | CAGRkXqTxse0sTb43z3kFAHDrffjkamHkFGfoLEtwRkr_QfDGGg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Alvaro,
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
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. 0002 adds a concurrent INSERT to repack_dropped.
I kept it apart in case you want only the fix.
Thanks,
Shihao
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0002-Test-dropped-column-values-in-inserts-replayed-by.patch | application/x-patch | 3.1 KB |
| v1-0001-Clear-out-dropped-column-values-from-inserts-repl.patch | application/x-patch | 3.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Heikki Linnakangas | 2026-10-05 15:48:51 | Re: [PATCH v1] Fix races in Windows pthread emulation |
| Previous Message | Hannu Krosing | 2026-10-05 15:37:09 | Re: Direct TOAST v2, faster, smaller and no migration needed |