model-writtenrun 5477 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Okano Naoki reported that executing EXEC SQL PREPARE before CONNECT crashed an embedded SQL application instead of returning an error, with reproductions on PostgreSQL 10, 12, and 14 #1.
- Tom Lane proposed initializing the thread-specific connection key before its use in both connection lookup functions, while noting that applications also needed error checks #2.
- Naoki Okano tested the patch on master and confirmed that it fixed crashes for both PREPARE and DISCONNECT CURRENT, endorsing the patch and agreeing that applications should handle errors #3.
- Tom Lane committed the patch with only comment and comparison-style cleanup, and backpatched the fix to all supported branches ba412c905a.
- Tom Lane confirmed that the fix had been pushed and would appear in the August releases rather than the imminent PostgreSQL 14.4 release, leaving no outstanding patch work in the thread #4.