Re: Unexpected reindex when altering column types for partitioned tables

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Álvaro Rodríguez <alvaro(at)datadoghq(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Unexpected reindex when altering column types for partitioned tables
Date: 2026-06-12 13:03:20
Message-ID: aivfWM5P77rer3rM@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2026-Jun-08, Álvaro Rodríguez wrote:

> When running the ALTER TABLE ALTER COLUMN TYPE operation, certain type
> changes are supposed to not require a reindex. For example, text to
> varchar or varchar(n) to varchar(m) when m > n. However, this turns
> out to not be the case for indexes (including pk / unique constraints)
> on partitioned tables. Patch 0001 (attached) demonstrates this
> behavior with a new regression test. In this case, the table rewrite
> is avoided but the indexes are rebuilt.

I agree with the problem statement, and I think the proposed solution
has the right shape. This obviously has to be kept for pg20, so let's
discuss further during the next commitfest; please create a CF entry for
it.

Thanks,

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shlok Kyal 2026-06-12 13:03:32 Re: synchronized_standby_slots behavior inconsistent with quorum-based synchronous replication
Previous Message Álvaro Herrera 2026-06-12 13:02:37 Re: Fix ALTER DOMAIN VALIDATE CONSTRAINT locking