model-writtenrun 5289 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Daniele Varrazzo reported that PQflush() could dereference a NULL connection and submitted a guard returning failure for NULL pointers or CONNECTION_BAD connections #1.
- Tom Lane considered adding a magic number to PGconn for broader pointer validation #2; Francisco Olarte questioned its usefulness, discussed a connection-table alternative, and highlighted the lack of documented guarantees for invalid pointers #3.
- Daniele reported that exercising most of libpq through psycopg 3 had exposed only PQflush() as needing a guard #4, but Tom's audit of exported functions also found missing NULL checks in PQisnonblocking() and PQdefaultSSLKeyPassHook_OpenSSL() #5.
- Tom committed the original PQflush() fix together with guards for the two additional functions, crediting both himself and Daniele; the broader pointer-validation proposals were not included bb9237a129.
- After the commit, Francisco requested documentation of NULL-connection behavior #6; the guard fixes had landed, while that documentation request and Tom's question about inconsistent handling of failed connections remained unresolved in the thread #5.