model-writtenrun 9828 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Tom Lane reported that postgres_fdw incorrectly assumed an EPQ outer plan always began with a join node, although a Sort could appear there, and attached a fix in #1.
- Tom explained that replacing a Sort targetlist produced invalid plans and misleading EXPLAIN output, while accessing Join fields without checking the node type could potentially crash; existing execution circumstances appeared to avoid the worst consequences #1.
- The patch guarded access to Join fields and exported change_plan_targetlist() to insert a Result node when projection was required, updating four regression EXPLAIN outputs accordingly #1.
- Tom committed the attached patch unchanged as 77d4d88afb, with backpatches covering supported branches through PostgreSQL 9.6.
- Robert Haas thanked Tom after the commit and acknowledged previously overlooking the assumption; his response supplies no qualifying pre-commit review, and the thread ended with the fix landed and no outstanding requests #2.