> This is the same race as in your find_all_inheritors(NoLock) thread [1]. As > I read v2 there, the missing_ok handling is internal to > find_all_inheritors(), so it wouldn't cover this new call. Maybe expose the > missing_ok variant and use it here, or go back to the v4 shape > (find_all_inheritors() on the table), since you saw no measurable > difference between them and v4 would get that fix for free.
You are right, I realized that while I was working on it, but it didn't seem like a big issue with find_all_inheritors behaving the same way already, and then I forgot about it when starting the other thread. Since (1) I think it's better if this thread doesn't depend on the outcome of the other and (2) I think the v4 version was overall simpler, I'm attaching the version of that with the original concerns fixed as v6. I thought a bit more about the performance question, but since we are already at the partitioned table code, it had to do the same iterations anyway, so it didn't make the indexed case better, even in theory. v6 has exactly the same issue as v5 without the fix from the other thread, but if that lands, it will handle both locations. I also did verify that there's no easy way to make the find_all_inheritors for repack locking and avoiding deadlocks, at least none I found.
v6-0001-Warn-when-REPACK-or-CLUSTER-skips-a-foreign-table.patch
Description: Binary data
