Implementing State Machines in PostgreSQL
Cool example. But, doing this will create a tight coupling between business logic , the state machine, and storage/persistence, Postgres.<p>If ever you decide you want to migrate away from Postgres, you'll need to rewrite all the business logic into some other out of process language. If ever you want to scale this, such that you want to calculate states in batches, you'd want to have the business logic somewhere else...