Re: REPACK (CONCURRENTLY) loses missing values of columns added without a rewrite

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Sami Imseih <samimseih(dot)pg(at)gmail(dot)com>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: REPACK (CONCURRENTLY) loses missing values of columns added without a rewrite
Date: 2026-09-24 12:18:11
Message-ID: arUTqtGASxpgU1v2@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2026-Sep-22, Sami Imseih wrote:

> REPACK (CONCURRENTLY) is not correctly accounting for missing values when
> applying decoded changes to the transient relation (NewHeap). This is
> because it is using the NewHeap descriptor, which intentionally has no
> missing values when it is formed in make_new_heap().

Hah, interesting, thanks.

I wonder why in your fix we keep a pointer to the whole relation instead
of just to its tupledesc. What about the attached v4?

I considered using CreateTupleDescCopyConstr, but it seems pointless:
the Relation pointer cannot go away while repack is running anyway. I
ran your test with only CreateTupleDescCopy() to see how would your new
test would fail (because such a descriptor wouldn't have the missing
attrs), but it failed differently, because attnotnull is not set.
Anyway, this was just a perhaps pointless experiment.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"Los cuentos de hadas no dan al niño su primera idea sobre los monstruos.
Lo que le dan es su primera idea de la posible derrota del monstruo."
(G. K. Chesterton)

Attachment Content-Type Size
v4-0001-Fix-REPACK-CONCURRENTLY-for-columns-added-without.patch text/x-diff 9.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nurlan Tulemisov 2026-09-24 12:50:05 Re: Import Statistics in postgres_fdw before resorting to sampling.
Previous Message Jonathan S. Katz 2026-09-24 12:13:17 Re: PostgreSQL 19 Beta 4 release announcement draft