Hi, While looking at d94964f14f39, I noticed a similar issue in a couple of other code paths which fail with "could not open relation with OID ..." or a cache lookup failure. This happens in plain REINDEX TABLE, CREATE INDEX on a partitioned table, and ALTER TABLE ... ATTACH PARTITION.
I think we can provide a similar fix, that is, pin the not-yet-processed relations open and release each pin right before it's processed, so the self-drop fails cleanly via CheckTableNotInUse() instead. Please find the attached patches. Thoughts? Thanks, Baji Shaik
0001-Prevent-self-dropped-index-from-crashing-plain-REIND.patch
Description: Binary data
0003-Prevent-self-dropped-index-from-crashing-ATTACH-PART.patch
Description: Binary data
0002-Prevent-self-dropped-partition-from-crashing-CREATE-.patch
Description: Binary data
