Re: [PATCH] REPLICA IDENTITY USING INDEX accepts column with invalid NOT NULL

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: solai v <solai(dot)cdac(at)gmail(dot)com>
Cc: Ante Krešić <ante(at)tigerdata(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] REPLICA IDENTITY USING INDEX accepts column with invalid NOT NULL
Date: 2026-08-12 18:00:02
Message-ID: anyz2fsgnrfR-ywd@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2026-Jun-18, solai v wrote:

> After applying the patch i repeated the same test.
> PostgreSQL correctly rejected the operation with
> ERROR: cannot use index "t_idx" as replica identity
> DETAIL: The constraint "id_nn" on column "id" is marked NOT VALID.
> HINT: You might need to validate it using ALTER TABLE ... VALIDATE CONSTRAINT.
>
> This matches the expected behavior,

I agree. I have pushed it now to all three branches.

The only problem left (famous last words!) on this at this point is that
somebody could have an instance in 18 where the replica identity has
already been set to an index with an invalid not-null, and they might
only find out when they try to pg_upgrade to 19 or 20 and it fails in
the middle of the upgrade. Would you be interested in patching
pg_upgrade so that it detects this problem during --check and reports it
there?

Thanks

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"Ellos andaban todos desnudos como su madre los parió, y también las mujeres,
aunque no vi más que una, harto moza, y todos los que yo vi eran todos
mancebos, que ninguno vi de edad de más de XXX años" (Cristóbal Colón)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2026-08-12 18:03:05 Re: Fix small psql slash option leaks
Previous Message Andrey Borodin 2026-08-12 17:26:04 Re: [PATCH]Fix pg_xact corruption from subtransaction abort after subcommit