title: SQL Unique Constraint with columns spanning multiple tables
body: <p>I have a scenario where i would need to add a unique constraint using columns from 2 different tables.
  I have 2 tables. The first table is like,</p>
  <pre><code>TABLE MODEL(
      ID PRIMARY_KEY,
      KEY
  )
  </code></pre>
  <p>and the second table as,</p>
  <pre><code>TABLE OWNERS(
      ID PRIMARY_KEY,
      MODEL_ID FOREIGN_KEY REFERENCES MODEL.ID,
      USER
  )
  </code></pre>
  <p>My requirement is the combination of <code>MODEL.KEY + OWNERS.USER</code> should be unique.
  How can we achieve this?</p>
  <p>Note:
  I'm using Postgres as database.
  There is no possibility of adding OWNERS.USER to MODEL table.</p>