Re: copy command - date

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: novice <user(dot)postgresql(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: copy command - date
Date: 2007-08-13 01:54:37
Message-ID: 13673.1186970077@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

novice <user(dot)postgresql(at)gmail(dot)com> writes:
> db5=> \copy maintenance FROM test.txt
> ERROR: invalid input syntax for integer: "3665 OK SM
> 07/07/13 06:09"
> CONTEXT: COPY maintenance, line 1, column maintenance_id: "3665 OK
> SM 07/07/13 06:09"

It looks to me like your problem is mostly that you don't have tabs
between the fields. I don't think COPY can be taught to parse this
input directly --- you need to preprocess the file to split the fields
apart.

BTW: after you get it split into fields, you're also going to find that
"OK" is not valid input for the integer "meter_id" column.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Paul Lambert 2007-08-13 01:55:15 Re: copy command - date
Previous Message novice 2007-08-13 01:49:13 Re: copy command - date