title: Copying CSV into Postgres table - invalid input syntax for type timestamp with time zone: "1"
body: <p>I'm creating a new table in Postgres that I want to copy data into, from a CSV file. The CSV data is like this:</p>
  
  <pre><code>nodeid,usertoken,application,starttime,endtime,count1,count2,count3,count4,count5,utctimestamp,timestamp
  ABCDE,84a6f486-97f1-4449-ad63-ae36e51392bd,AB,2019-09-15 00:09:10.365+00,2019-09-15 00:11:57.403+00,1,0,0,1,2,2019-09-15 00:11:57.403+00,2019-09-15 00:11:57.403+00
  </code></pre>
  
  <p>I create the Postgres table like this:</p>
  
  <pre><code>CREATE TABLE test_table
  
  (
  
    nodeid text,
  
    usertoken text,
  
    application text,
  
    starttime timestamp with time zone,
  
    endtime timestamp with time zone,
  
    count1 integer,
  
    count2 integer,
  
    count3 integer,
  
    count4 integer,
  
    count5 integer,
  
    utctimestamp timestamp with time zone,
  
    "timestamp" timestamp with time zone,
  
    msgid serial NOT NULL,
  
    CONSTRAINT test_table_pkey PRIMARY KEY (msgid)
  
  )
  
  WITH (
  
    OIDS=FALSE
  
  );
  </code></pre>
  
  <p>I then use this command using <code>psql</code>, to try to copy the data from the CSV file (where myfilename is the name of the csv file)</p>
  
  <pre><code>COPY test_table(nodeid, usertoken, application, starttime, endtime, count1, count2, count3, count4, count5, utctimestamp, timestamp) FROM 'myfilename.csv' DELIMITER ',' CSV HEADER;
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>ERROR:  invalid input syntax for type timestamp with time zone: "1"
  CONTEXT:  COPY test_table, line 2, column endtime: "1"
  </code></pre>
  
  <p>The error appears to be indicating that the <code>count1</code> value is being used as the value for insertion as <code>endtime</code>, however I'm not seeing why that would be the case</p>