title: PostgreSQL: Conditional unique constraint
body: <p>Given: </p>
  
  <pre><code>----------------------------------
        vin     | driver | is_owner
  --------------+--------+----------
   231431cxzv87 | bob    | true
   231431cxzv87 | jeff   | false
   231431cxzv87 | greg   | false
   32342klj234s | jeff   | true
  </code></pre>
  
  <p>Is there a way to add a constraint so that there is only one owner per vin?  </p>
  
  <hr>
  
  <p><strong>Edit:</strong> I found <a href="http://archives.postgresql.org/pgsql-novice/2007-04/msg00045.php" rel="noreferrer">this question</a>.<br>
  Is adding a <a href="http://www.postgresql.org/docs/8.4/interactive/indexes-partial.html" rel="noreferrer">partial unique index</a> meant to suit this purpose?</p>