title: PG COPY error: 'invalid input syntax for integer' when importing quoted CSV file without any integers
body: <p>When trying to use the <a href="http://www.postgresql.org/docs/current/static/sql-copy.html" rel="noreferrer"><code>COPY</code></a> command via SQL in Postgres 9.5.1 in a simple example database…</p>
  
  <p>I am getting this error:</p>
  
  <pre class="lang-none prettyprint-override"><code>ERROR:  invalid input syntax for integer: "Sally"
  CONTEXT:  COPY customer_, line 2, column id_: "Sally"
  
  ********** Error **********
  
  ERROR: invalid input syntax for integer: "Sally"
  SQL state: 22P02
  Context: COPY customer_, line 2, column id_: "Sally"
  </code></pre>
  
  <p>…when importing this data in CSV (comma-separated value):</p>
  
  <pre class="lang-none prettyprint-override"><code>"first_name_","last_name_","phone_","email_"
  "Sally","Jones","425.555.1324","s.jones@acme.com"
  "Jarrod","Barkley","206.555.3454","j.barkley@example.com"
  "Wendy","Melvin","415.555.2343","wendy@wendyandlisa.com"
  "Lisa","Coleman","425.555.7282","lisa@wendyandlisa.com"
  "Jesse","Johnson","507.555.7865","j.j@guitar.com"
  "Jean-Luc","Martin","212.555.2244","jean-luc.martin@example.com"
  </code></pre>
  
  <p>…being imported via the following SQL executed in pgAdmin:</p>
  
  <pre class="lang-sql prettyprint-override"><code>COPY customer_
  FROM '/home/parallels/Downloads/customer_.csv'
  CSV 
  HEADER
  ;
  </code></pre>
  
  <p>…into this table:</p>
  
  <pre class="lang-sql prettyprint-override"><code>-- Table: public.customer_
  
  -- DROP TABLE public.customer_;
  
  CREATE TABLE public.customer_
  (
    id_ integer NOT NULL DEFAULT nextval('customer__id__seq'::regclass),
    first_name_ text NOT NULL,
    last_name_ text NOT NULL,
    phone_ text NOT NULL DEFAULT ''::text,
    email_ text NOT NULL DEFAULT ''::text,
    CONSTRAINT pkey_customer_ PRIMARY KEY (id_)
  )
  WITH (
    OIDS=FALSE
  );
  ALTER TABLE public.customer_
    OWNER TO postgres;
  COMMENT ON TABLE public.customer_
    IS 'Represents a person  whose pets visit our clinic.';
  </code></pre>
  
  <p>So it seems the first row containing the names of the columns is being processed successfully. The failure point is with the first data value in the first data line of the CSV. None of my imported data is of integer type, so the I am befuddled by the error message. The only integer is the <code>id_</code> primary key, auto-incrementing <code>SERIAL</code>.</p>
  
  <p>I did read the Question page on <a href="https://stackoverflow.com/q/18297980/642706">PG COPY error: invalid input syntax for integer</a>. But that question did involve integer values, and the lack thereof in an empty quoted string being interpreted as a NULL. In my case here we have no integer values in the data; the only integer is the primary key <code>SERIAL</code> column with a <code>DEFAULT</code> generated value (not in the data being imported).</p>
  
  <p>I also found the Question, <a href="https://stackoverflow.com/q/35636210/642706">PostgreSQL ERROR: invalid input syntax for integer</a>. But it seems irrelevant.</p>