title: Why is the UNIQUE constraint failing on this INSERT?
body: <p>I'm trying to copy tables from olddb.sqlite3 into newdb.sqlite3 using the method suggested <a href="https://stackoverflow.com/questions/2359205/copying-data-from-one-sqlite-db-to-another">here</a>.</p>
  
  <pre><code>bash-3.2$ cat cp.sql 
  ATTACH "olddb.sqlite3" AS old;
  INSERT INTO feedback_phone SELECT * FROM old.feedback_phone;
  bash-3.2$ rm newdb.sqlite3 
  bash-3.2$ touch newdb.sqlite3 
  bash-3.2$ sqlite3 newdb.sqlite3 &lt; cp.sql 
  Error: near line 3: UNIQUE constraint failed: feedback_phone.id_
  </code></pre>
  
  <p>Why is this happening? I know the id_ column consists of unique integers:</p>
  
  <pre><code>bash-3.2$ sqlite3 olddb.sqlite3 
  SQLite version 3.8.5 2014-08-15 22:37:57
  Enter ".help" for usage hints.
  sqlite&gt; .schema feedback_phone
  CREATE TABLE feedback_phone (
          id_ INTEGER NOT NULL, 
          phone VARCHAR, 
          language VARCHAR, 
          kind VARCHAR, 
          user VARCHAR, 
          timestamp DATETIME, 
          success BOOLEAN, 
          url VARCHAR, 
          PRIMARY KEY (id_), 
          CHECK (success IN (0, 1))
  );
  sqlite&gt; select id_ from feedback_phone;
  1
  2
  3
  4
  5
  6
  7
  8
  9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  </code></pre>
  
  <p>I'm copying that table from one database into a different database that is completely empty. What exactly is violating the constraint?</p>