Re: pg_dump INDEX ATTACH versus --clean option

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pg_dump INDEX ATTACH versus --clean option
Date: 2021-01-12 23:22:19
Message-ID: 20210112232219.GA14665@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021-Jan-12, Tom Lane wrote:

> I think actually the cleanest fix would be to invent ALTER INDEX DETACH
> PARTITION and use that as the dropStmt for the INDEX ATTACH object.
> No idea how painful that would be to do, though. I suppose it'd involve
> reverting the parent index back to an invalid state.

Right. The initial submitted patch did have DETACH, and on review we were kinda
happy that we were able to remove that and avoid indexes that can revert from valid to
invalid state. I don't recall the precise reason, but it can probably
be found in the archives ... perhaps starting at
https://postgr.es/m/flat/CAKJS1f9G6hnahJpoLaHavrKt0uPyYZncEi2rq__kLQcrGE_FMQ(at)mail(dot)gmail(dot)com

As far as the code goes, DETACH was already in some version older than
what got committed; I suppose we could easily crib stuff from there.
It had a new alter table subcommand, so it'd not be a backpatchable fix
in that way; we'd need some different parse node representation, I
think. One problem that was definitely not solved, is that in
multi-level partitioning setups, we would have to lock relations from
the top down.

--
Álvaro Herrera Valdivia, Chile

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2021-01-12 23:40:59 Re: pg_preadv() and pg_pwritev()
Previous Message Ryan Lambert 2021-01-12 23:14:13 Re: WIP: System Versioned Temporal Table