Skip site navigation (1) Skip section navigation (2)

Re: ERROR: invalid input syntax for integer:

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: e-letter <inpost(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: ERROR: invalid input syntax for integer:
Date: 2011-09-22 00:07:04
Message-ID: 3547.1316650024@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
e-letter <inpost(at)gmail(dot)com> writes:
> A database table was created with the command:
> CREATE TABLE tablename (column1 bigint,date date,time time,column2 text)
> a csv file was imported, of structure:
> 123456,2000-01-01,01:10,"sometext"
> Using the command:
> \copy tablename from file.csv
> Causes the command terminal error:
>  input syntax for integer: "123456,2000-01-01,01:10,"sometext""
> CONTEXT:  COPY tablename, line 1, column column2: "123456

I don't believe that \copy will default to assuming that the file is in
csv format.  You probably need to add "format csv" or something similar
to that command.

			regards, tom lane

In response to

Responses

pgsql-novice by date

Next:From: James HartleyDate: 2011-09-22 00:33:41
Subject: Re: ERROR: invalid input syntax for integer:
Previous:From: e-letterDate: 2011-09-21 23:04:07
Subject: ERROR: invalid input syntax for integer:

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group