model-writtenrun 6038 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Zhijie Hou reported that attaching or detaching a partitioned partition left descendants' cached partition constraints stale, supplying examples where DETACH wrongly rejected inserts and ATTACH wrongly accepted them #1 #2 #4.
- Alvaro Herrera supplied a preliminary DETACH fix that invalidated direct children's relcache entries, while flagging uncertainty about concurrent DETACH and requesting an ATTACH reproducer #3.
- Amit Langote expanded the fix to ATTACH and indirect descendants, explaining that every descendant's constraint must change and that descendants must be locked before invalidation; he subsequently fixed compilation errors and added regression tests #5 #6.
- Nitin Jadhav reviewed the patch favorably and suggested eliminating temporary OID variables; Pavel Borisov reported testing with Maxim Orlov, including successful installcheck-world results and tests that exposed the unfixed bug, and supplied that cleanup #7 #8.
- Amit proposed weaker descendant locking for concurrent DETACH, but Pavel pointed out that its final phase takes AccessExclusiveLock on the detached partition; Amit restored that lock mode and removed redundant discussion links from the tests, after which Pavel declared the patch ready #9 #10 #11 #12.
- Alvaro initially questioned whether the regression test exposed the DETACH failure, then verified that the preceding ATTACH failure masked it when both fixes were absent and retained Amit's test unchanged #13 #14.
- Alvaro committed #11 as d6f1e16c8f with only naming, formatting, and commit-message cleanup, crediting Amit and himself as authors and Nitin and Pavel as reviewers; he announced backpatching to all supported branches, through PostgreSQL 10, and Amit's acknowledgment closed the thread with the fix landed #15 #16.