Hi Sehrope, > QueuePartitionConstraintValidation() in tablecmds.c stores only the first > element of the implicit-AND list it is handed. [...] When the new bound > is a LIST bound that includes NULL, the negation of the bound has two > conjuncts, so only the IS NOT NULL test is ever checked.
I reproduced this on master (10b6e2a3d66), and the analysis matches what I see. With the patch the ATTACH is correctly rejected, and make check passes (239/239). While confirming it I ran a few more shapes against master, and the bug is a little wider than the single-column case in the test: it also leaves orphan rows when the partition key spans several columns, and when the default partition is itself partitioned (the row ends up in the sub-default and the same pruning hides it). Both are the same root cause -- the NULL-inclusive LIST bound is what makes the negation a two-conjunct AND -- and both are fixed by the patch, since make_ands_explicit() in the shared function validates the whole conjunction regardless of the bound's shape. The cases I tried, for the record: - single-column LIST, IN (v, NULL): leaks on master, fixed. - multi-column table, LIST on one column + NULL: leaks on master, fixed. - default partition that is itself partitioned: leaks on master, fixed (the row lands in the sub-default). - single-column and composite RANGE bounds: already rejected, unchanged. - a valid ATTACH into a NULL-inclusive default: still succeeds, no over-rejection. Given that, it might be worth adding a multi-column or a sub-partitioned case next to the one you have, so the wider shape is covered as well -- though the fix is at the root, so a single case does guard it. The patch looks correct to me. Regards, Manu
