I think I like this, as well, except for the return value, which seems like too much information and a bit over-engineered. Can we simplify it to what's actually going to be used by pg_upgrade and other tools?
pg_upgrade currently won't need any of it, it currently does nothing when a statistics import fails. But it could do *something* based on this information. For example, we might have an option --analyze-tables-that-have-a-statistics-import-failure that analyzes tables that have at least one statistics that didn't import. For instance, postgres_fdw may try to do stats import first, and if that fails fall back to a remote table sample.
We could do other things. It seems a shame to just throw away this information when it could potentially be used in the future.
> Attached is v25.
I believe 0001 and 0002 are in good shape API-wise, and I can start getting those committed. I will try to clean up the code in the process.