model-writtenrun 2264 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Nikita Kalinin reported an assertion failure in create_mergejoin_plan() while planning a postgres_fdw join with FOR UPDATE, supplying a reproducer and backtrace in #1.
- Tender Wang reproduced the failure and initially suggested changing incremental-sort selection in #2, then recognized that fully sorted input should need no additional Sort node in #3.
- Richard Guo explained that the assertion exposed an older redundant-sort bug in #4 and traced it to GetExistingLocalJoinPath() replacing foreign join inputs with already ordered local EPQ paths without clearing their sort requirements in #5; Tender Wang confirmed the older-version behavior in #8.
- Richard Guo proposed clearing outersortkeys and innersortkeys after replacing already sorted inputs in #6, accepting inaccurate retained sort costs because EPQ plan cost accuracy was not important.
- David Rowley proposed caching presorted-key counts to eliminate repeated ordering checks in #7; Richard Guo explained why the desired-order lists remained necessary in #9, and David withdrew their proposed removal while advocating caching with assertions in #10.
- Richard Guo submitted the bug fix and caching optimization together in #11, retaining the desired-order lists and caching only outer-path counts because incremental sort does not support the mark/restore required for inner paths; Tender Wang reviewed both patches favorably in #12.
- Richard Guo committed the bug-fix patch unchanged as 773db22269 and announced it in #13, leaving backpatching open because older branches only suffered redundant sorting in rarely important EPQ plans.
- Richard Guo committed the caching patch as c06e909c26 with two added zero initializations and announced it in #14 as a suitable completion of the incremental-sort work for PostgreSQL 18; both submitted patches had landed on master by the thread's end.