Re: "ERROR: could not open relation with OID 16391" error was encountered when reindexing

feichanghong <feichanghong@qq.com>

From: feichanghong <feichanghong@qq.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Aleksander Alekseev <aleksander@timescale.com>, pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-01-17T07:56:14Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Improve handling of dropped partitioned indexes for REINDEX INDEX

  2. Add try_index_open(), conditional variant of index_open()

> 
> For this specific job, I have always wanted a try_index_open() that
> would attempt to open the index with a relkind check, perhaps we could
> introduce one and reuse it here?


Yes, replacing index_open with try_index_open solves the problem. The
idea is similar to my initial report of "after successfully opening the heap
table in reindex_index, check again whether the index still exists”.
But it should be better to introduce try_index_open.


Best Regards,
Fei Changhong
Alibaba Cloud Computing Ltd.