model-writtenrun 8129 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Domagoj Smoljanovic reported intermittent parallel pg_restore deadlocks between truncating a partition and adding its parent's primary key on PostgreSQL 12.4 in #1 and #4.
- Alvaro Herrera and Tom Lane initially suspected restore ordering or missing dependencies, but Tom's experiments identified two backend locking problems: partition TRUNCATE locked the parent, while ALTER TABLE ONLY on the parent locked its children #3 #5 #6.
- Tom traced these locks to eager partition-constraint loading in InitResultRelInfo and unnecessary SET NOT NULL recursion; Alvaro highlighted the empty constraint of a lone default partition and suggested computing constraints only when needed #7 #8.
- Tom posted the recursion fix in #9, reporting that it alone resolved the deadlock and proposing backpatching it while keeping the ResultRelInfo change on the development branch to avoid extension ABI risks.
- Amit Langote demonstrated that traditional inheritance permits a child to drop NOT NULL independently, invalidating the recursion patch's assumption, and separately submitted lazy partition-constraint fetching for the TRUNCATE problem #11 #12.
- Tom and Amit agreed to restrict the recursion optimization to partitioned tables, preserving ordinary inheritance behavior while covering pg_restore's problem; Tom delayed pushing until the PostgreSQL 13 branch freeze ended #13 #14 #15.
- Tom questioned both the redundant assertion and the constant-true expression used for empty partition constraints, so Amit removed them in the revised lazy-fetch patch #16 #17.
- Tom committed the recursion patch from #9 as e5fac1cb19, adding the partitioned-table restriction and backpatching through PostgreSQL 12; the broader inheritance issue remained outside this fix #18.
- Tom committed Amit's revised patch from #17 as 2000b6c10a on the development branch only, restoring ExecConstraints' original assertion-based contract and improving comments after examining its history #18.
- Both fixes had landed by the thread's close, and Amit resolved Tom's remaining documentation concern by identifying existing comments at the relevant constraint checks, which Tom accepted #20 #21.