model-writtenrun 8510 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- The thread opens with Richard Guo's announcement of Shihao Zhong's planner workaround: virtual generated columns of partitioned tables cannot safely prove non-nullness for NOT IN conversion because reads use the parent's expression while constraints use the partition's expression #1.
- Álvaro Herrera proposed requiring matching virtual generation expressions, and Richard Guo agreed that the mismatch also undermines CHECK constraints #2 #3; Shihao initially favored deferring the broader fix to PostgreSQL 20, but Álvaro argued for backpatching all affected releases #4 #5 #6.
- Shihao accepted the backpatch approach and submitted checks for CREATE TABLE PARTITION OF, ATTACH PARTITION, and whole-tree SET EXPRESSION, together with pg_upgrade detection and a diagnostic SQL query #7; plain inheritance and stored columns remained unchanged, and existing divergent partitions would need repair before restoring dumps into patched PostgreSQL 18.
- Manu demonstrated additional wrong results with constraint_exclusion enabled and reported successful cross-branch testing, but found that PostgreSQL 18's CHECK-constraint restriction blocked the suggested repair #8; Shihao consequently expanded the pg_upgrade diagnostic #9.
- Álvaro's documentation and code-comment review led to clearer descriptions of expression matching #10 #11 #12, and Manu's further tests exposed misleading repair guidance for nested partitions and child-only CHECK constraints #13; Shihao updated the guidance to identify the root table, constraints throughout the tree, and incompatible existing rows #14.
- Zsolt Parragi found that implicit versus explicit casts could pass expression equality and later diverge after ALTER TYPE, pending-detach partitions could escape the restrictions, and plain inheritance had the same constraint-related wrong results #15.
- Shihao responded by comparing deparsed expressions, extending enforcement and pg_upgrade detection to plain inheritance, and guarding pending detaches and multiple-parent trees #16; he explained that PostgreSQL 19 still needed the planner workaround for existing divergent partitions and deferred a CREATE TABLE LIKE combined with INHERITS loophole to a separate thread.
- Zsolt then showed that combining ADD COLUMN and SET EXPRESSION bypassed the multiple-parent check and that the suggested parent-level repair could be impossible #17; Shihao moved tree validation to execution time and restricted the hint to partitions, while leaving rejection of the combined command as an alternative for discussion #18.
- The series remains under review: Manu reported that the latest version passed prior tests on master, PostgreSQL 19, and PostgreSQL 18, but requested repair instructions using NO INHERIT for existing multiple-parent divergences and a narrower ADD COLUMN check that would not reject unrelated pre-existing mismatches #19; no landing of the restriction series is recorded.