The query hit the database, but the table couldn’t hold the new data without a change. You need a new column.
Adding a column is one of the most common schema changes, but it can still break production if done poorly. The key is to design, migrate, and deploy with zero downtime. Whether you are working with PostgreSQL, MySQL, or a cloud-native warehouse, the principles remain the same: minimize locks, keep indexes under control, and plan for backward compatibility in your code.
First, define the column with the correct type from the start. Changing types later will often lock the table and block writes. If the column holds nullable values, add it without defaults to avoid table rewrites. In PostgreSQL, ALTER TABLE ... ADD COLUMN with NULL is fast. In MySQL, be aware of storage engines that may still lock the table; test on staging before live migration.
Second, manage defaults in application logic before pushing them into the schema. Set them in the code path, write new data with the new column, and backfill in batches using UPDATE with LIMIT to avoid long locks. Monitor replication lag during the process, especially in high-traffic environments.