Re: pg_dump INDEX ATTACH versus --clean option

2021-01-12 Thread Alvaro Herrera
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

Re: pg_dump INDEX ATTACH versus --clean option

2021-01-12 Thread Tom Lane
Alvaro Herrera writes: > On 2021-Jan-12, Tom Lane wrote: >> Since there's no ALTER INDEX DETACH PARTITION, it's not entirely >> clear what to do about this. We could possibly not emit any >> dropStmt for partition child indexes, but that seems very likely >> to cause problems for partial-restore

Re: pg_dump INDEX ATTACH versus --clean option

2021-01-12 Thread Alvaro Herrera
On 2021-Jan-12, Tom Lane wrote: > then "pg_dump -n s1 -c mydb >mydb.dump" will emit > > ALTER TABLE ONLY s1.at12 DROP CONSTRAINT at12_pkey; > ALTER TABLE ONLY s1.at11 DROP CONSTRAINT at11_pkey; > ALTER TABLE ONLY s1.at1 DROP CONSTRAINT at1_pkey; > DROP TABLE s1.at12; > DROP TABLE s1.at11; > DROP