model-writtenrun 3723 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Amadeo Gallardo reported a reproducible “cache entry already complete” error after upgrading from PostgreSQL 14 to 16.1 in #1; after Tom Lane requested a self-contained example in #2, Gallardo supplied one in #4, and David Rowley reproduced it after adding ANALYZE in #5.
- Tom Lane identified the failing Memoize node and questioned its duplicate cache keys and single-row flag in #6; David Rowley concluded that inner uniqueness depended on a join filter outside the parameterized scan in #7.
- David Rowley’s initial patch in #8 detected remaining join filters and cleared Memoize’s singlerow flag, with diagnostic EXPLAIN output, but he observed that early termination of unique joins left cache entries incomplete and suggested rejecting Memoize for this case instead.
- Richard Guo replaced that approach in #11, explaining that PostgreSQL 16’s cloned clauses inflated ppi_clauses and defeated an existing rejection check; his patch counted distinct clause serial numbers and added a regression test.
- David Rowley questioned whether similar clause-counting hazards affected merge joins and whether SingleRow output remained useful in #12; Richard Guo explained why join restriction lists exclude duplicate clones and agreed that the extra EXPLAIN field was unnecessary in #13.
- David Rowley committed the production-code hunk from #11 as 2bcf0785cd, credited Richard Guo as author, and backpatched the fix to PostgreSQL 16; the proposed regression test was omitted.
- The thread ended with David Rowley confirming the distinct-serial check in #14 and explaining that the reproducer would not reliably guard against other bugs causing the same error; the fix had landed, with no further patch work proposed.