model-writtenrun 4519 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Alvaro Herrera opened the thread by showing JSON_SERIALIZE silently truncating its output to invalid JSON when RETURNING varchar was too short #1.
- David G. Johnston and Tom Lane initially defended consistency with explicit casts, but Peter Eisentraut supplied the SQL standard's overlength-error requirement and an Oracle comparison; Tom then accepted implicit-cast behavior #2 #4 #5 #7 #8.
- Amit Langote submitted a typmod-sensitive coercion patch and raised whether its changes to PostgreSQL 16 constructors should be backpatched; Jian He's domain and DEFAULT-expression examples led to expanded handling and tests #10 #11 #12 #13.
- Jian He's further tests showed that cast expressions could throw errors instead of invoking ON ERROR, prompting Amit to remove JsonExpr.coercion_expr, use runtime coercion, and separate query-function changes from constructor changes #14 #15 #16.
- The runtime implementation was cleaned up, its remaining stale references reviewed, and its quote-handling path revised before the two-patch submission was finalized #17 #18 #19.
- The constructor component of #19 landed unchanged as c2d93c3802, while its runtime-coercion component landed with comment cleanup and a catalog-version bump as 716bd12d22.
- Alvaro Herrera and Tom Lane challenged the committed typmod and domain logic; Jian He proposed category-specific adjustments, while Amit instead proposed replacing the constructor machinery with assignment-level casts #20 #21 #22 #23.
- After Jian He confirmed the assignment-cast patch worked, Amit committed it following a delay as 2177306a64, retaining the earlier tests and adding explanatory comments and an implicit cast-display form #24 #26.
- Jian He returned to unresolved bit-string behavior-expression conversions with a revised patch; Amit retained its tests but rejected extensive automatic-conversion special cases, choosing assignment casts and hints asking users to cast DEFAULT expressions explicitly #27 #28.
- Jian challenged the proposed NULL-on-coercion-failure behavior and supplied an additional patch rejecting inconsistent JSON-valued EXISTS columns; Amit instead chose runtime coercion for those values and explicit errors when behavior-expression coercion fails #29 #30 #31.
- Further tests exposed integer-domain EXISTS failures, a useless executor jump, and domain-over-jsonb quote and error-handling problems, leading Amit to expand the work into five patches and then correct the OMIT QUOTES regression test #32 #33 #34 #35.
- The third attachment in #35 was split into error capture as 63e6c5f4a2 and detailed error reporting as 231b7d670b, with result-pointer initialization and tests adjusted for the split.
- The domain-over-jsonb OMIT QUOTES fix and dead-jump removal from #35 landed unchanged as 4fc6a55560 and 8a1a4087bd, leaving two rebased casting patches in review #36.
- While reviewing the remaining work, Jian He proposed skipping unnecessary NULL behavior-expression evaluation and identified misleading ErrorSaveContext documentation and inconsistent JSON_TABLE default-behavior representation #37.
- The remaining casting patches from #36 landed as 74c96699be and 7f56eaff2f, with comment cleanup, an exists_check_domain rename, and reduced duplicate tests; both commits credit Jian He and Amit Langote #38.
- After a vacation and competing work delayed the follow-ups, Amit submitted separate fixes for the ErrorSaveContext comment, JSON_TABLE's default ON ERROR representation, and redundant column deparsing #40 #41.
- Amit added a simplified version of Jian He's executor optimization to the series, but deferred committing during the PostgreSQL 17 release freeze #42.
- Jian approved the comment fix and questioned duplicated deparsing tests and optimization conditions; Amit kept the deparsing fixes separate, reordered them, and generalized the optimization to recognize NULL-valued Const expressions #43 #44.
- The comment and two deparsing components of #44 landed unchanged as 3422f5f93f, 68222851d5, and 565caaa79a.
- The optimization component of #44 also landed unchanged as e4e27976a6, completing the announced push #45.
- Buildfarm failures forced Amit to revert both deparsing changes and the optimization from the development and PostgreSQL 17 branches; he identified EXPLAIN VERBOSE tests as the deparsing problem and initially suspected LLVM interaction for the optimization #46.
- Amit re-pushed the column-deparsing and default-ON-ERROR components of #44 as ee75a03f37 and bbd4c058a8, preserving their implementation while replacing EXPLAIN VERBOSE tests with view-definition inspection, and confirmed the re-push in #47.
- At the final message, Amit posted an updated optimization that leaves omitted jump targets at -1 and falls back to jump_end, avoiding LLVM's objection to shared targets #47; that exact patch subsequently landed on September 9 as dd8bea88ab, completing the submitted follow-up fixes.
- The separate question of applying OMIT or KEEP QUOTES consistently to DEFAULT expressions was left for possible implementation or documentation, without a resolution reported in the remainder of the thread #34.