title: Recursive Foreign Key Issue
body: <p>In my DB design, I need a table with recursive foreign key relation i.e. the foreign key refers to the same table. When I try it with one column it works fine, but when I use two columns it gives an error. Below is the sample code and the resulting error. Your help will be highly appreciated.</p>
  
  <pre><code>CREATE TABLE categories (
  categoryID integer ,
  parentID integer ,
  setID integer REFERENCES categories(categoryID,parentID),
  name char(255) NOT NULL,
  PRIMARY KEY(categoryID,parentID)
  );
  </code></pre>
  
  <blockquote>
    <p>ERROR:  number of referencing and referenced columns for foreign key disagree</p>
  </blockquote>
  
  <p>When I use </p>
  
  <pre><code>setID integer REFERENCES categories(categoryID) and 
  PRIMARY KEY(categoryID) 
  </code></pre>
  
  <p>then it gives no error, but that's not what I want.</p>