model-writtenrun 5646 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Julien Rouhaud proposed a SQL function to display rewritten queries with expanded views, including an alias fix and regression tests, because nested views made the effective query difficult to inspect #1.
- Ranier Vilela supplied a revised patch correcting an error message, simplifying the empty-string check, and reusing the output buffer; Julien explained that the empty-string check should instead be removed entirely #3 #4.
- Tom Lane opposed a core SQL interface that could imply lasting guarantees about rewriting and SQL reconstruction, favoring an internal API for extensions; Gilles Darold explained its value for deeply nested views, and Julien replaced the SQL function with an exported get_query_def() #5 #7 #9 #10.
- After a seven-month gap, Pavel Stehule reviewed the patch and questioned generating aliases during rewriting because relation names could collide across schemas; Julien moved alias enforcement into the deparser, which already generated unique reference names #12 #14 #15.
- Pavel successfully tested the revision, and Bharath Rupireddy reviewed its SQL interface and memory handling, prompting Julien to discover that he had attached the obsolete SQL-function branch and resend the intended C API patch with the same alias fix #16 #17 #18.
- Pavel ran check-world successfully and suggested a test module, but Julien worried that maintaining such a module would imply the interface guarantees previously rejected; Pavel accepted proceeding without it and marked the patch ready for a committer #20 #21 #22.
- Tom found header-check failures and recommended a simpler wrapper that would avoid exposing internal types and parameters; Julien introduced pg_get_querydef() returning an allocated string and consolidated duplicated pretty-print flag selection #24 #25.
- Tom requested a fuller API comment and questioned exposing wrapping and indentation controls, so Julien reduced the wrapper to a Query argument and a pretty-print boolean #26 #27.
- Tom committed the final patch as d22646922d, preserving its behavior while adjusting comments, formatting, function placement, and equivalent alias-condition structure, and reported the push in #28.
- The thread ended with the C API landed and Julien announcing an extension implementing the original query-inspection use case; the core SQL function remained outside the committed scope #29.