title: "ERROR: extra data after last expected column" when using PostgreSQL COPY
body: <p>Please bear with me as this is my first post. </p>
  
  <p>I'm trying to run the <a href="http://www.postgresql.org/docs/9.2/static/sql-copy.html" rel="noreferrer">COPY</a> command in PostgreSQL-9.2 to add a tab delimited table from a .txt file to a PostgreSQL database such as:</p>
  
  <pre><code>COPY raw_data FROM '/home/Projects/TestData/raw_data.txt' WITH (DELIMITER ' ');
  </code></pre>
  
  <p>I've already created an empty table called "raw_data" in the database using the SQL command:</p>
  
  <pre><code>CREATE TABLE raw_data ();
  </code></pre>
  
  <p>I keep getting the following error message when trying to run the <code>COPY</code> command:</p>
  
  <pre><code>ERROR:  extra data after last expected column
  CONTEXT:  COPY raw_data, line 1: "  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  30  31  32  33  34  35  36  ..."
  </code></pre>
  
  <p>(The numbers here are supposed to be the column headings)</p>
  
  <p>I'm not sure if its because I didn't specify table columns when creating the db table but I'm trying to avoid having to manually enter in 800 or columns.</p>
  
  <p>Any suggestions on how to fix this?</p>
  
  <p>Here's an example of what the .txt file looks like:</p>
  
  <pre><code>        1   2   3   4   5   6   7   8   9
  binary1 1   1   0   1   1   1   1   1   1
  binary2 1   0   0   1   0   1   1   0   0
  binary3 1   0   1   1   1   0   0   1   0
  binary4 1   1   1   1   0   1   0   1   0
  </code></pre>