Hacker News new | ask | show | jobs
by amluto 318 days ago
> ALTER TABLE events ADD COLUMN version INT DEFAULT 1;

I’ve always disliked this approach. It conflates two things: the value to put in preexisting rows and the default going forward. I often want to add a column, backfill it, and not have a default.

Fortunately, the Iceberg spec at least got this right under the hood. There’s “initial-default”, which is the value implicitly inserted in rows that predate the addition of the column, and there’s “write-default”, which is the default for new rows.