Re: Using COPY

Lists: pgsql-novice
From: Juan Francisco Diaz <j-diaz(at)publicar(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Using COPY
Date: 2003-09-02 15:22:04
Message-ID: BB7A1FCC.2A6%j-diaz@publicar.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Hi, im trying to use the copy command to load some data in my tables but i
get the following message:

000081": can't parse "pg_atoi: error in "0

When i execute the following command:

copy carconffuente from
'/users/juanf/documents/scriptspostgresql/tablacarconffuente'

The file structure is like this:

000081 16 53 60 0.84999999999999998 70 0 0 0
000081 17 29 60 0.80000000000000004 70 0 0 0
000081 18 37 60 0.94999999999999996 70 0 0 0

And the first column's type is CHAR(6).

The file was exported from mssqlserver2000 with ANSI coding, <cr> as row
separator, no quotes for the texts, and TAB as the column separator.

Thanks a lor in advance

JuanF


From: Nabil Sayegh <postgresql(at)e-trolley(dot)de>
To: Juan Francisco Diaz <j-diaz(at)publicar(dot)com>
Cc: pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Using COPY
Date: 2003-09-02 15:38:59
Message-ID: 1062517139.13843.17.camel@billy
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Am Di, 2003-09-02 um 17.22 schrieb Juan Francisco Diaz:
> Hi, im trying to use the copy command to load some data in my tables but i
> get the following message:
>
> 000081": can't parse "pg_atoi: error in "0
>
> When i execute the following command:
>
> copy carconffuente from
> '/users/juanf/documents/scriptspostgresql/tablacarconffuente'
>
> The file structure is like this:
>
> 000081 16 53 60 0.84999999999999998 70 0 0 0
> 000081 17 29 60 0.80000000000000004 70 0 0 0
> 000081 18 37 60 0.94999999999999996 70 0 0 0
>
> And the first column's type is CHAR(6).

Are you sure that the table has _exactly_ these columns ?

Try specifying the columnnames explicitly:

COPY table (colname1, colname2, ...) FROM ...

--
e-Trolley Sayegh & John, Nabil Sayegh
Tel.: 0700 etrolley /// 0700 38765539
Fax.: +49 69 8299381-8
PGP : http://www.e-trolley.de


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Juan Francisco Diaz <j-diaz(at)publicar(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Using COPY
Date: 2003-09-02 17:03:35
Message-ID: 19456.1062522215@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

Juan Francisco Diaz <j-diaz(at)publicar(dot)com> writes:
> The file was exported from mssqlserver2000 with ANSI coding, <cr> as row
> separator, no quotes for the texts, and TAB as the column separator.

Wrong thing :-(. COPY will *only* accept <lf> as row separators.

This is relaxed for 7.4, but you're evidently not on 7.4 yet ...

regards, tom lane


From: Tomka Gergely <tomka(at)zeus(dot)gau(dot)hu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Juan Francisco Diaz <j-diaz(at)publicar(dot)com>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Using COPY
Date: 2003-09-03 06:30:09
Message-ID: Pine.LNX.4.33.0309030829330.31338-100000@zeus.gau.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-novice

2003-09-02 ragyogó napján Tom Lane ezt üzente:

> Juan Francisco Diaz <j-diaz(at)publicar(dot)com> writes:
> > The file was exported from mssqlserver2000 with ANSI coding, <cr> as row
> > separator, no quotes for the texts, and TAB as the column separator.
>
> Wrong thing :-(. COPY will *only* accept <lf> as row separators.
>
> This is relaxed for 7.4, but you're evidently not on 7.4 yet ...

tr '\r' '\n' < badfile > goodfile

--
Tomka Gergely
"S most - vajon barbárok nélkül mi lesz velünk?
Ők mégiscsak megoldás voltak valahogy..."