title: Add constraint to make column unique per group of rows
body: <p>There is a column <code>status</code> in a Postgres table which can take only two values: <code>Active</code> and <code>Inactive</code>.</p>
  
  <p>One of the columns is named <code>userid</code>. The table can have multiple rows with the same <code>userid</code> but at most one of them can have <code>status = 'Active'</code>. I need only one or no <code>status</code> as <code>Active</code> per <code>userid</code>. How can I create a constraint with this condition? I couldn't find any help from the Postgres documentation.</p>