Re: REPACK (CONCURRENTLY) loses missing values of columns added without a rewrite - Mailing list pgsql-hackers

From Álvaro Herrera
Subject Re: REPACK (CONCURRENTLY) loses missing values of columns added without a rewrite
Date
Msg-id arUTqtGASxpgU1v2@alvherre.pgsql
Whole thread
In response to REPACK (CONCURRENTLY) loses missing values of columns added without a rewrite  (Sami Imseih <samimseih.pg@gmail.com>)
Responses Re: REPACK (CONCURRENTLY) loses missing values of columns added without a rewrite
List 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

pgsql-hackers by date:

Previous
From: "Jonathan S. Katz"
Date:
Subject: Re: PostgreSQL 19 Beta 4 release announcement draft
Next
From: Nurlan Tulemisov
Date:
Subject: Re: Import Statistics in postgres_fdw before resorting to sampling.