model-writtenrun 4003 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Justin Pryzby reported that ANALYZE on inheritance tables briefly combined stale blocks-scanned counts with a new blocks-total value, reproducing the inconsistency with assertions during regression tests #1.
- Justin Pryzby's inline proposal reset the scanned counter when acquire_sample_rows() set the total and added broader consistency assertions to the progress infrastructure #1.
- Heikki Linnakangas supplied an attached replacement that reset both counters when acquire_inherited_sample_rows() updated the child relation ID, also covering foreign-table sampling functions that might never update progress #3.
- Heikki Linnakangas declined to include the diagnostic assertions because they required backend_progress.c to understand the meanings of individual commands' counters #3.
- Heikki Linnakangas committed the attached patch unchanged as c181f2e2bc, backpatched the fix through PostgreSQL 13, and closed the thread by confirming the commit and backports #4.