model-writtenrun 8294 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Justin Pryzby identified that pg_rewind checked the first result row for missing-file metadata on every loop iteration, potentially skipping every file, and Daniel Gustafsson confirmed the required row-index correction in #1 and #2.
- Michael Paquier attached a patch correcting the index and moving metadata extraction after the missing-file check in #4, initially reasoning that this also prevented an atol() crash.
- Daniel Gustafsson explained that PQgetvalue() returns an empty string for NULL rather than a null pointer and suggested filtering missing files in the SQL query in #5.
- Michael Paquier accepted the crash correction but preferred avoiding extra query complexity for an uncommon case in #6, and Daniel accepted the attached approach in #7.
- Michael Paquier committed #4 unchanged as 1d09fb1f0a and announced backpatching through PostgreSQL 9.5 in #8; he also identified the same bug in his separately maintained 9.4 and 9.3 versions and planned to fix those next.