Re: Correct docs re: rewriting indexes when table rewrite is skipped

From: James Coleman <jtc331(at)gmail(dot)com>
To: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Correct docs re: rewriting indexes when table rewrite is skipped
Date: 2022-03-30 14:04:21
Message-ID: CAAaqYe_J=Rb48OewtGe70JH91Fa2MYZsnsqBsq9VM_GGZbDo5g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 29, 2022 at 11:29 AM Matthias van de Meent
<boekewurm+postgres(at)gmail(dot)com> wrote:
>
> On Tue, 29 Mar 2022 at 16:04, James Coleman <jtc331(at)gmail(dot)com> wrote:
> >
> > Back in 367bc42 (for 9.2!) we "avoid[ed] index rebuild[ing] for
> > no-rewrite ALTER TABLE
> > .. ALTER TYPE." However the docs still claim that "a table rewrite is
> > not needed; but any indexes on the affected columns must still be
> > rebuilt."
>
> Although indexes might indeed not need a rebuild, in many cases they
> still do (e.g. when the type changes between text and a domain of text
> with a different collation).
>
> I think that the current state of the docs is better in that regard;
> as it explicitly warns for index rebuilds, even when the letter of the
> docs is incorrect: there are indeed cases we don't need to rebuild the
> indexes; but that would require more elaboration.

Admittedly I hadn't thought of that case. But isn't it already covered
in the existing docs by the phrase "or an unconstrained domain over
the new type"? I don't love the word "or" there because there's a
sense in which the first clause "binary coercible to the new type" is
still accurate for your example unless you narrowly separate "domain"
and "type", but I think that narrow distinction is what's technically
there already.

That being said, I could instead of removing the clause entirely
replace it with something like "indexes may still need to be rebuilt
when the new type is a constrained domain".

Thoughts?

James Coleman

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2022-03-30 14:35:36 basebackup/lz4 crash
Previous Message Mark Dilger 2022-03-30 13:59:48 Re: Granting SET and ALTER SYSTE privileges for GUCs