model-writtenrun 1848 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- BugForge reported a PostgreSQL 17.6 server crash in ExecInterpExpr with a reproducer combining aggregates, nested CTEs, and a window clause in #1.
- Vik Fearing confirmed that the reproducer also crashed PostgreSQL 16 and reported limited query simplifications in #2; this was investigation of the original bug before a patch was posted.
- Tom Lane explained in #3 that count() was assigned to an outer query level despite referencing a CTE defined below that level, leaving a dangling CTE reference and causing either a planner error or a broken execution plan.
- Tom Lane attached a parser fix in #3 that treats CTE references similarly to variable references when calculating aggregate levels, while noting that a simpler regression test was still needed.
- b649ef2446 subsequently landed the fix from #3 with a revised comment and a focused regression test, with backpatching through PostgreSQL 13; the thread ends at the patch submission and contains no subsequent patch review or confirmation.