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

From Sami Imseih
Subject Re: REPACK (CONCURRENTLY) loses missing values of columns added without a rewrite
Date
Msg-id CAN12+Y+p-+uqwKAnqXN=hAUR5wFrb5o6DnJwa=kKaveLtaTqhw@mail.gmail.com
Whole thread
In response to Re: REPACK (CONCURRENTLY) loses missing values of columns added without a rewrite  (shihao zhong <zhong950419@gmail.com>)
Responses Re: REPACK (CONCURRENTLY) loses missing values of columns added without a rewrite
Re: REPACK (CONCURRENTLY) loses missing values of columns added without a rewrite
List pgsql-hackers
> 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)

Attachment

pgsql-hackers by date:

Previous
From: Manu
Date:
Subject: Re: Add a test for index_rebuild_count of REPACK (CONCURRENTLY)
Next
From: Jelte Fennema-Nio
Date:
Subject: Re: CI slowdown due to PG_TEST_INITDB_EXTRA_OPTS