title: ERROR: extra data after last expected column in postgres table
body: <p>I am working on a project where I need to create a new table, then import data from a CSV. I've read many similar questions ("extra data after last expected column") and answers on StackOverflow, but I still haven't found the culprit.</p>
  
  <pre><code>CREATE TABLE colleges2014_15 (
  unitid integer, 
  intsnm text, 
  city text, 
  stabbr text, 
  zip_clean char, 
  control integer, 
  latitude float, 
  longitude float, 
  tutionfee_in float, 
  tuitionfee_out float, 
  pctpell float,
  inc_pct_lo float, 
  dep_stat_pct_ind float, 
  dep_debt_mdn float, 
  ind_debt_mdn float, 
  pell_debt_mdn float,
  ugds_men float, 
  ubds_women float, 
  locale integer, 
  PRIMARY KEY(unitid)
  );
  </code></pre>
  
  <p>The table is created successfully with the 19 different columns. Then I go try to import the data into the new table.</p>
  
  <pre><code>COPY colleges2014_15(
  unitid, 
  intsnm, 
  city, 
  stabbr, 
  zip_clean, 
  control, 
  latitude, 
  longitude, 
  tutionfee_in, 
  tuitionfee_out, 
  pctpell,
  inc_pct_lo, 
  dep_stat_pct_ind, 
  dep_debt_mdn, 
  ind_debt_mdn, 
  pell_debt_mdn, 
  ugds_men, 
  ubds_women, 
  locale
  )
  FROM '/Users/compose/Downloads/CollegeScorecard_Raw_Data x/MERGED2014_15_cleaned.csv' CSV HEADER
  ;
  </code></pre>
  
  <p>And I get the error message. I've done the following in the CSV:</p>
  
  <ul>
  <li>Made sure it's saved as UTF-8 CSV (working on a Mac)</li>
  <li>Already cleaned out all commas in every row</li>
  <li>Cleaned out all NULL values</li>
  <li>Confirmed that all the data types (integer, float, text, etc.) are correct</li>
  <li>I've tried to simply COPY only the first column, <code>unitid</code>; it failed. I've tried importing only the second column (<code>intsnm</code>) and it failed with the same error. </li>
  </ul>
  
  <p>The full error message when trying to COPY over all 19 columns is as follows:</p>
  
  <blockquote>
    <p>An error occurred when executing the SQL command: COPY
    colleges2014_15( unitid,  intsnm,  city,  stabbr,  zip_clean, 
    control,  latitude,  longitude,  tutionfee_in,  tuitionfee_out, 
    pctpell, inc_pct_...</p>
    
    <p>ERROR: extra data after last expected column   Where: COPY
    colleges2014_15, line 2: "100654,Alabama A &amp; M
    University,Normal,AL,35762,35762,1,34.783368,-86.568502,9096,16596,0.7356,0.651..."
    1 statement failed.</p>
    
    <p>Execution time: 0.03s</p>
  </blockquote>
  
  <p>The full error message when trying to copy simply the first column only is:</p>
  
  <blockquote>
    <p>An error occurred when executing the SQL command: COPY
    colleges2014_15( unitid ) FROM
    '/Users/compose/Downloads/CollegeScorecard_Raw_Data
    x/MERGED2014_15_cleaned.csv' CSV HEADER</p>
    
    <p>ERROR: extra data after last expected column   Where: COPY
    colleges2014_15, line 2: "100654,Alabama A &amp; M
    University,Normal,AL,35762,35762,1,34.783368,-86.568502,9096,16596,0.7356,0.651..."
    1 statement failed.</p>
    
    <p>Execution time: 0.01s</p>
  </blockquote>
  
  <p>Hugely appreciate any help.</p>