The query ran, and the table was wrong. A missing field. A gap where data should be. You need a new column.
Adding a new column to a database table can seem simple. It is not. The wrong move locks your table, stalls queries, or corrupts data. The right move slips it in without anyone noticing.
First, know your environment. In MySQL, ALTER TABLE ADD COLUMN can lock the table. On large datasets, that downtime is deadly. In PostgreSQL, adding a new nullable column with a default value can rewrite the whole table unless done carefully. In SQL Server, certain operations are metadata-only, while others trigger full rebuilds. Every database handles a new column differently.
Second, decide on column definition and constraints. Adding a non-null column with no default is a fast way to break inserts. Choose nullability with purpose. If you must initialize values, do it in steps: add the new column as nullable, backfill in controlled batches, then enforce constraints. This avoids long locks and transaction spikes.