| From: | Kirill Reshke <reshkekirill(at)gmail(dot)com> |
|---|---|
| To: | Sami Imseih <samimseih(dot)pg(at)gmail(dot)com> |
| Cc: | shihao zhong <zhong950419(at)gmail(dot)com>, 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:03:44 |
| Message-ID: | CALdSSPima5c+n-btODPd4tyr-Euv4zRPdN6xbPjxXmMhu68X=Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, 23 Sept 2026 at 23:41, Sami Imseih <samimseih(dot)pg(at)gmail(dot)com> wrote:
>
> > v2 fixes the issue you mentioned.
>
> Thanks for checking!
>
> > I think It also fixes another case. If the added column is in the replica
> > identity index, REPACK looks up the row with a NULL key. That fails the
> > Assert in find_target_tuple(), or gives "could not find target tuple"
> > without assertions. Adding this to the test covers it:
> >
> > CREATE UNIQUE INDEX repack_test_i_c_idx ON repack_test (i, c);
> > ALTER TABLE repack_test REPLICA IDENTITY USING INDEX repack_test_i_c_idx;
>
> ahh, good repro. It's worse for a pass-by-reference column, i.e. TEXT.
> find_target_tuple() only sets sk_argument, never SK_ISNULL, so the
> comparison function gets a NULL pointer rather than a NULL key.
> So a non assert build will actually segfault.
>
> v3 uses a TEXT column in the identity index, which covers the int case
> too since both go through the same sk_argument.
>
> --
> Sami Imseih
> Amazon Web Services (AWS)
Hi!
I reproduced this while stress testing REPACK (CONCURRENTLY) on HEAD.
Whats worse, this issue makes the database unrestorable via pg_dump/COPY.
I also checked DROP COLUMN, ALTER TYPE, SET STORAGE, SET COMPRESSION,
SET NOT NULL, ADD/DROP CONSTRAINT NOT VALID/VALIDATE, virtual
generated columns and found no related issue (both with and without
v3).
So patch LGTM
--
Best regards,
Kirill Reshke
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jonathan S. Katz | 2026-09-24 12:13:17 | Re: PostgreSQL 19 Beta 4 release announcement draft |
| Previous Message | Trakshan Mishra | 2026-09-24 12:01:14 | Re: [PATCH] Fix segmentation fault caused by reentrancy in RI_Fkey_cascade_del (ri_triggers.c) |