title: What is causing this sqlite foreign key mismatch?
body: <p>I already checked out <a href="https://stackoverflow.com/q/5208245/344286">this question</a>, and thought I had the answer - but then it didn't look right to me.</p>
  
  <p>I have the following pared down example:</p>
  
  <pre><code>CREATE TABLE pipelines (                                                        
          name VARCHAR NOT NULL,                                                  
          owner VARCHAR NOT NULL,                                                 
          description VARCHAR,                                                    
          PRIMARY KEY (name, owner),                                              
          FOREIGN KEY(owner) REFERENCES user (id)                                 
  );                                                                              
  CREATE TABLE tasks (                                                            
          id INTEGER NOT NULL,                                                    
          title VARCHAR,                                                          
          pipeline VARCHAR,                                                       
          owner VARCHAR,                                                          
          PRIMARY KEY (id),                                                       
          FOREIGN KEY(pipeline) REFERENCES pipelines (name),                      
          FOREIGN KEY(owner) REFERENCES pipelines (owner)                         
  );                                                                              
  CREATE TABLE user (                                                           
          id VARCHAR NOT NULL,                                                    
          name VARCHAR,                                                           
          password VARCHAR,                                                       
          PRIMARY KEY (id)                                                        
  );                                                                              
  pragma foreign_keys=on;                                                         
  
  insert into user values ('wayne', '', '');                                    
  insert into pipelines values ('pipey', 'wayne', '');                            
  insert into tasks values (1, 'hello', 'pipey', 'wayne'); 
  </code></pre>
  
  <p>When executing this code, it bails out:</p>
  
  <pre><code>$ sqlite3 foo.sq3 '.read mismatch.sql'    
  Error: near line 27: foreign key mismatch
  </code></pre>
  
  <p>Through the list in the question I cited:</p>
  
  <ul>
  <li>the parent table (user) exists.</li>
  <li>the parent columns (name, owner) exist</li>
  <li>the parent columns are, in fact, the primary key (I thought that may have been it originally)</li>
  <li>the child table references all of the primary key columns in the parent table</li>
  </ul>
  
  <p>So what in the world could be causing this error?</p>