model-writtenrun 4373 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Alexander Lakhin reported that returning [[], "a"] from PL/Python caused invalid writes because the conversion allocated zero elements but subsequently stored scalar values, with reproduction across supported branches #1.
- Tom Lane replaced manual size calculation with ArrayGetNItems() in #2; the initial fix landed with an added regression test as 81eaaf65e3, also represented by the older-branch candidate b7c6af375d.
- Alexander exposed order-dependent handling of nested lists and strings in #3, and Tom traced it to inconsistent nesting-depth checks in #4; Tom then proposed stricter checks in #5, initially avoiding backpatching because previously accepted inputs would fail.
- Alexander tested the stricter checks, highlighted the remaining treatment of empty Python lists as scalars, and discovered that malformed Perl arrays could pass inconsistent dimensions and datum counts to array construction #6.
- Tom fixed the PL/Perl issue without an attached patch, producing f47004add1 and the older-branch candidate ea96fbe772; he then proposed borrowing PL/Perl's single-pass ArrayBuildState approach for Python #7.
- Although Alexander initially favored postponing the broader rewrite until PostgreSQL 17 #8, Tom supplied it in #9, treating empty sublists as zero-length dimensions and fixing Python reference leaks on error with guaranteed cleanup.
- Alexander tested the rewrite successfully and supported including it in the current development release, while reporting a separate asymmetry in core SQL array parsing #10.
- Tom ultimately argued that stable releases should receive consistent rectangularity checks rather than retain the initial fix's strange empty-list behavior #11; the rewrite landed with an equivalent MAXDIM comparison simplification as 0553528e7c, with older-branch adaptations in aa7e5e4043.
- Tom closed the thread by stating that all reported PL/Perl and PL/Python issues were resolved and that the remaining core array-parser issue was being tracked separately #12.