title: Postgres: two foreign keys to same primary key field
body: <pre><code>create table date_dimension (
  id serial primary key,
  date_id date,
  ..... others
  );
  
  create table temp (
  id serial primary key,
  from_date integer,
  to_date integer,
  value integer,
  foreign key (from_date, to_date) references date_dimension(id, id)
  );  
  </code></pre>
  
  <p>How can I refer both <code>from_date</code> and <code>to_date</code> to <code>id</code> field in <code>date_dimension</code>?<br>
  The current code fails to do that saying  </p>
  
  <pre><code>ERROR:  there is no unique constraint matching given keys for referenced table "date_dimension"  
  </code></pre>
  
  <p>Thank you</p>