title: Rails and Postgres - COPY from .cvs to table while skipping created_at column
body: <p>My client has given me a  list of vehicles for a project.  I need to get them into a table I can use, but they're currently in a .cvs file.  I've <a href="http://www.postgresql.org/docs/9.1/interactive/sql-copy.html" rel="nofollow noreferrer">read</a> <a href="http://wiki.postgresql.org/wiki/COPY" rel="nofollow noreferrer">around</a> and <a href="https://stackoverflow.com/questions/2987433/how-to-import-csv-file-data-into-a-postgres-table">found</a> some info, but nothing that solves my particular problem.  </p>
  
  <p>I've generated a model that matches the info in the .cvs file(id, year, make, model, trim), run the migration, and now have the table I need.  The issue comes up when I try to use psql COPY.  Here's what I've read will work:</p>
  
  <pre><code>copy list_vehicles from '/path/to/list.csv' DELIMITERS ',' CSV;
  </code></pre>
  
  <p>but it gives me</p>
  
  <pre><code>ERROR:  missing data for column "created_at"
  </code></pre>
  
  <p>Fine, so I try this:</p>
  
  <pre><code>copy list_vehicles (id, year, make, model, trim)  from '/path/to/list.csv' DELIMITERS ',' CSV;
  </code></pre>
  
  <p>and I get back </p>
  
  <pre><code>ERROR:  null value in column "created_at" violates not-null constraint
  </code></pre>
  
  <p>Ok, so then this should work:</p>
  
  <pre><code>copy list_vehicles (id, year, make, model, trim)  from '/path/to/list.csv' DELIMITERS ',' WITH NULL AS ' ' CSV FORCE NOT NULL created_at;
  </code></pre>
  
  <p>nope, </p>
  
  <pre><code>ERROR:  FORCE NOT NULL column "created_at" not referenced by COPY
  </code></pre>
  
  <p>I'm not sure where to go from here.  I was thinking of trying to take the created_at column back out for now, then add it in another migration?  Any guidance would be much appreciated. </p>
  
  <p>Thanks</p>