model-writtenrun 8887 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Teodor Sigaev reported a production aggregate crash, credited Nikita Glukhov with helping investigate, and attached a patch checking null flags alongside transition pointers in four execution paths #1.
- Andres Freund questioned the crash mechanism, requested a smaller reproducer and regression test, and opposed adding branches to frequently executed transition code #2; Tom Lane emphasized that a NULL Datum has no guaranteed numerical value #4.
- Andres Freund traced the pointer-only comparison back to PostgreSQL 7.4 and identified how a stale pointer associated with NULL could prevent a subsequent non-null value from being copied into a sufficiently long-lived context #5.
- Andres Freund reproduced the failure and explained how strict-function evaluation can leave a previous Datum behind while setting its null flag, allowing a non-strict aggregate transition function to propagate that combination; he proposed zeroing NULL transition values inside ExecAggTransReparent() #8.
- Andres Freund supplied a smaller reproducer and an inline zeroing fix, but judged the reproducer too dependent on allocation behavior for a regression test and declined broader normalization of NULL Datums in other hot paths #9.
- Andres Freund committed the inline approach as affdde2e15, adding comments, an assertion and shared reparenting logic for ordinary aggregates, with backports through PostgreSQL 9.4; his final message confirmed the landing and left Valgrind annotations for detecting misuse of NULL Datums as an open idea #10.