Implementing State Machines in PostgreSQL | Hacker News Reader