model-writtenrun 5822 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Justin Pryzby reported that psql's \d still failed when a partition and its parent had unrelated, non-inherited triggers with the same name #1.
- Justin submitted a LIMIT 1 fix relying on pg_partition_ancestors() returning ancestors in order, together with a regression test and a separate query-formatting patch #2.
- Tom Lane objected that the join need not preserve ancestor order and suggested following tgparentid, possibly using a recursive CTE or limiting the display to the immediate parent #3.
- Justin retained the ancestor-based approach but added WITH ORDINALITY and ORDER BY depth, reporting a passing smoke test; Tom initially remained concerned about unrelated same-named triggers and clarified that tgparentid identifies a trigger rather than a relation #4 #5.
- Tom then accepted that stopping at the first matching trigger with tgparentid = 0 excludes unrelated triggers farther up the ancestry, and offered to document the reasoning and simplify query construction #6.
- Tom committed Justin's revised series with those cleanups, a CASE guard avoiding ancestor lookup for non-inherited triggers, and removal of NULLIF; the commit records backpatching to PostgreSQL 13, completing the fix after the thread's final message #4 9007d4ea77.