PostgreSQL supports this with partial unique indexes.
CREATE UNIQUE INDEX foo_only_one_active ON foo(state) WHERE (state = 'active');
CREATE UNIQUE INDEX foo_only_one_active ON foo(state) WHERE (state = 'next');
will constrain the table such that only one row may have state 'active' or 'next'. You can use a single index with state IN ('active', 'next')
if you prefer, but I think this form is more likely to actually get used in queries for state = 'active'
or state = 'next
'.