model-writtenrun 8672 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Justin Pryzby reported that directory-listing SRFs used with LIMIT could leave directories open until transaction end in #1, and Tom Lane explained that the bug predated the PostgreSQL 11 warning in #2.
- Tom recommended reading the entire directory into a tuplestore, identified six affected SRFs, and explained that shutdown callbacks would not prevent simultaneous calls from exhausting scarce resources in #4.
- Tom also identified unnecessary memory cleanup before SRF_RETURN_DONE() and proposed documenting automatic memory-context cleanup in #5.
- Justin submitted the initial pg_ls_dir_files() conversion in #6, which Tom committed with validation and error-handling edits plus regression tests as 085b6b6679, announcing the result in #7.
- Justin extended materialization to pg_ls_dir(), pg_tablespace_databases(), pg_logdir_ls_internal(), pg_timezone_names(), and pgrowlocks(), with documentation warnings, in #8.
- Alvaro Herrera requested a string-literal style correction and questioned whether ValuePerCall needed a final shutdown call in #10, but Tom retained the existing API and pointed to RegisterExprContextCallback in #11.
- Justin's revised series added regression tests and a separate redundant-pfree() cleanup patch in #12, incorporating the string-literal correction without changing the materialization approach.
- Tom committed the broader SRF fixes with local implementation adjustments, expanded documentation, and a revised tablespace test as b4570d33aa, and committed the memory-cleanup subset separately as 41b45576d5, confirming both in #13; the bug fixes were backpatched, while the cleanup remained development-branch only.
- A buildfarm failure exposed a race between directory enumeration and stat() when a WAL file disappeared, prompting Tom to propose ignoring ENOENT in #15.
- Justin raised the implications for dangling symlinks in #16, and Tom's follow-up patch combined ENOENT handling with a switch to lstat(), thereby excluding symlinks, in #18.
- Justin challenged that additional behavior change in #19, while Fabien COELHO advocated a general directory-listing function with file-type information and SQL wrappers in #22; Tom treated that broader interface as separate work in #23.
- Justin requested preserving stat() behavior for stable releases in #25, Tom accepted in #26, and 82e8018522 landed the ENOENT handling from #18 without its lstat() change.
- Months later, Alexander Lakhin reported that concurrent deletion could instead produce ERROR_ACCESS_DENIED on Windows in #27, and Tom recommended handling such behavior in a shared Windows stat wrapper in #28.
- The thread ended with Tom pointing to existing win32stat.c handling that he had not personally tested in #30; the four candidate commits had landed, but this thread supplied no further patch or resolution for the Windows failure.