I wrote: > Here's a draft patch for this. It seems to fix the problem in > light testing.
I realized that the "repro" I had for this isn't testing the same thing that Dimitrios is seeing; what it is exposing looks more like a bug or at least a behavioral change due to the v18 work to record not-null constraints in pg_constraint [1]. So my patch may fix his problem or it may not. It would be good to have a reproducer that fails (not necessarily every time) in v17 or earlier. In addition to that uncertainty, pushing the patch now would get in the way of identifying what's really going on at [1]. So I'm going to sit on it for now, and maybe it's going to turn into v19 material. regards, tom lane [1] https://www.postgresql.org/message-id/1280408.1744650810%40sss.pgh.pa.us