model-writtenrun 3461 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Steve Chavez proposed pg_basetype() to replace recursive catalog queries with a SQL wrapper around getBaseType(), including documentation and tests in #1, and explained its usefulness to metadata consumers such as PostgREST and pg_graphql in #2.
- Alexander Korotkov identified duplicate syscache lookups and proposed an extended internal helper in #3; jian he implemented that direction in #4, while John Naylor questioned the importance of the optimization for interactive administration in #5.
- jian he returned to Steve Chavez's original implementation in #6, moved its documentation into the catalog-information section, and changed the declared argument type to any without yet adapting the C implementation.
- Tomas Vondra reviewed the patch and explored pg_basetypeof() naming and an optional pg_typeof() argument in #7 and #9; Tom Lane argued for accepting a type OID in #10, and Tomas identified the any-argument implementation mismatch in #11.
- Tom Lane favored resolving the complete domain chain without adding a separate single-level function in #12, while jian he opposed extending pg_typeof() for this narrower use case in #13.
- jian he nevertheless continued the expression-based interface, correcting argument-type extraction in #14 and removing the preliminary syscache lookup in #15; Alexander Korotkov endorsed that version while questioning its name in #16.
- Tom Lane reiterated that accepting type OIDs supports catalog queries and can be composed with pg_typeof() in #17; jian he adopted the regtype interface in #18 and raised the resulting cache-lookup error for invalid input.
- jian he added a proposed Basetype column to psql's domain display in #19, but Tom Lane identified its failure against older servers in #20 and later opposed the mostly redundant extra width in #21.
- Tom Lane supplied a revised function in #21 that traversed domain types locally to tolerate concurrent type removal without complicating the frequently used internal helper, initially returning invalid OIDs unchanged and polishing strictness, documentation, and tests.
- Tom Lane committed b154d8a6d0 from #21 with invalid OIDs returning NULL, corresponding documentation and test updates, relocated tests, and a catalog-version bump; his final message #22 confirmed the landing, leaving the psql extension out.