model-writtenrun 7666 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Laurenz Albe opened the thread with a demonstration that quitting psql's editor without saving could execute the previous SQL statement, even when editing a different script file, and proposed clearing the query buffer in #1.
- Chapman Flack argued that quitting without changes should preserve existing buffer contents without executing them in #2 and #4; Laurenz's revised patch in #5 preserved current-buffer editing behavior while introducing conditional clearing for recalled queries and function/view definitions, with the intention of also covering script files.
- After a gap of nearly three months, Jacob Champion tested the patch and found that saving a temporary file quickly could escape the modification-time check in #6; discussion in #7 and #8 examined whether this was pre-existing behavior, and Laurenz added a file-size check in #9.
- Jacob clarified that simply saving and quitting could trigger the race and proposed backdating temporary files in #10; Laurenz implemented epoch backdating in #11, and Jacob reported successful feature, documentation, and installcheck-world testing in #12.
- Tom Lane objected to assuming an epoch in the past and to failing editor commands when utime() failed in #13, while Juan José SantamarÃa Flecha confirmed FAT's coarse timestamp resolution in #14; Laurenz revised the patch to use a recent timestamp and ignore utime() failures in #15.
- Tom split out the race fix from #15 into 48d67fd897, using a two-second offset and a file-size check, and backpatched it as an independent bug fix; he posted the remaining behavior change in #16.
- In #16, Tom also identified the missing function/view 'No changes' message, requested a clearer do_edit() contract, and suggested returning a boolean from copy_previous_query(); Laurenz incorporated those changes in #17.
- Tom committed #17 with additional edits as 55873a00e3, including unconditional discard-on-quit for explicit filenames and buffer clearing after read errors; his announcement in #18 explained that filename behavior must not depend on whether the query buffer was initially empty.
- Laurenz acknowledged the final commit in #19, leaving both the separately backpatched race fix and the development-branch editor-behavior change landed, with no remaining patch awaiting review.