TIL: Creating tables without primary keys CAN cause updates and deletes to fail in Postgres

A long time ago, I read in a medical book that One can learn about a system when things go wrong. So diseases are a good way to learn more about how the human body functions. That sentence stuck with me and this is about a story where someone made a mistake and learned something (someone, not me, I don’t make mistakes). It was friday afternoon (why do all tech disaster stories start on friday? This one doesn’t start on friday) It was a less dramatic Wednesday afternoon, the smell of a freshly baked migration was in the air. I was rubbing my hands with joy, waiting to press merge once I got that LGTM. I had worked hard on the migration and I was quite proud that I thought a lot about the changes and data model. I was adding a new table, how hard can that be? ...

June 7, 2024 · 8 min · Abhinav Omprakash