model-writtenrun 7022 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Joel Jacobson sought exactly-one-row enforcement for SQL-standard functions while retaining dependency tracking, proposing either ROWS 1 ENFORCED or a function-level setting #1.
- Pavel Stehule suggested scalar subqueries and warned about inlining implications; Joel demonstrated that scalar subqueries reject multiple rows but silently return null for zero rows, leading Pavel to suggest a NOT NULL return flag #2 #3 #4.
- After encountering the restriction on data-modifying CTEs inside scalar subqueries, Joel demonstrated wrapping a SETOF SQL update function in a scalar subquery, leaving null rejection as the missing check #5 #10.
- Vik Fearing pointed out that a legitimate null result must be distinguished from an incorrect row count; David G. Johnston proposed a general row-count clause, while Vik proposed CHECK DIAGNOSTICS (ROW_COUNT = 1), which Joel favored #13 #14 #16 #17.
- Joel demonstrated a PL/pgSQL null-checking helper, and Pavel explored count-checking helpers and EXACT syntax; Joel preferred CHECK DIAGNOSTICS but submitted a smaller, generally useful nonnull(anyelement) function as an interim solution #17 #18 #19 #20.
- A side discussion clarified the dependency-tracking tradeoff: David explained that parsed SQL-standard bodies bind objects like views, and Tom Lane confirmed that referenced objects must exist when such functions are created #23 #25.
- Joel added documentation and regression tests without changing the null-checking implementation #27.
- David accepted the documentation file but suggested grouping related null predicates and questioned composite-value semantics; Joel preferred keeping the function in the comparison-functions table and proposed error_on_null to clarify that only an actual null input should fail #28 #29.
- At the thread's close, Pavel endorsed Joel's proposal, and Joel intended to move the narrower function patch to a new thread; general row-count enforcement remained unimplemented here #29 #30.
- The narrower function continued in thread #52200, whose later patchset #599371 became the source of Michael Paquier's commit 2b75c38b70, with light naming, documentation, and array-test edits; this supersedes attribution of the commit directly to this thread's earlier patchset #27.