pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedWierd error for COPY command
5+ messages / 3 participants
[nested] [flat]
* Wierd error for COPY command
@ 2002-04-26 15:42 Josh Berkus <josh@agliodbs.com>
0 siblings, 1 reply; 5+ messages in thread
From: Josh Berkus @ 2002-04-26 15:42 UTC (permalink / raw)
To: pgsql-sql
Folks,
I'm getting the following error:
jwnet=# copy elbs_udf from '/home/jwnet/testtransfer/udf.txt'
jwnet-# using delimiters '|' with null as '';
": can't parse "ne 1, pg_atoi: error in "1
jwnet=#
I know from previous experience that this is a garbled error message
indicating that there is a problem on one line of the file. However,
that particular file has 2 million lines, so finding the problem
without a line number would be nigh impossible. The log only shows the
same error message.
Ideas, anyone?
-Josh Berkus
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Wierd error for COPY command
@ 2002-04-26 16:11 Tom Lane <tgl@sss.pgh.pa.us>
parent: Josh Berkus <josh@agliodbs.com>
0 siblings, 1 reply; 5+ messages in thread
From: Tom Lane @ 2002-04-26 16:11 UTC (permalink / raw)
To: Josh Berkus <josh@agliodbs.com>; +Cc: pgsql-sql
"Josh Berkus" <josh@agliodbs.com> writes:
> I'm getting the following error:
> jwnet=# copy elbs_udf from '/home/jwnet/testtransfer/udf.txt'
> jwnet-# using delimiters '|' with null as '';
> ": can't parse "ne 1, pg_atoi: error in "1
> jwnet=#
I'll bet your file contains \r\n newlines not \n. The weird look
of the error comes from copy echoing the \r as part of the "data
item" it's unhappy about. Try examining the log entry using od -c
if you want to see exactly what's there.
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Wierd error for COPY command
@ 2002-04-26 16:51 Josh Berkus <josh@agliodbs.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 5+ messages in thread
From: Josh Berkus @ 2002-04-26 16:51 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; Josh Berkus <josh@agliodbs.com>; +Cc: pgsql-sql
Tom,
> I'll bet your file contains \r\n newlines not \n. The weird look
> of the error comes from copy echoing the \r as part of the "data
> item" it's unhappy about. Try examining the log entry using od -c
> if you want to see exactly what's there.
Yes, you're right. Apparently I have /r/n newlines, plus a ZL string
in the last field indicating Null. I know that there's a command line
utility to convert DOS newlines into UNIX newlines; could anyone give
me a name?
-Josh Berkus
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh@agliodbs.com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Wierd error for COPY command
@ 2002-04-26 17:15 Josh Berkus <josh@agliodbs.com>
parent: Josh Berkus <josh@agliodbs.com>
0 siblings, 1 reply; 5+ messages in thread
From: Josh Berkus @ 2002-04-26 17:15 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql
Tom,
> Yes, you're right. Apparently I have /r/n newlines, plus a ZL string
> in the last field indicating Null. I know that there's a command
> line
> utility to convert DOS newlines into UNIX newlines; could anyone give
> me a name?
Answered my own question. The utility "dos2unix" (which is a script
file on top of "recode") is included in most Linux distributions. It
works as follows:
either:
dos2unix filename
or:
dos2unix filename newfilename
... depending on your distro.
Thanks!
-Josh Berkus
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Wierd error for COPY command
@ 2002-04-26 17:25 PG Explorer <pgmail@pgexplorer.com>
parent: Josh Berkus <josh@agliodbs.com>
0 siblings, 0 replies; 5+ messages in thread
From: PG Explorer @ 2002-04-26 17:25 UTC (permalink / raw)
To: Josh Berkus <josh@agliodbs.com>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql
need dos2unix do you?
here is a script
#!/bin/sh
tr -d '\015' < $0 > $1
chmod +x dos2unix
usage : dos2unix dosfile unixfile
http://www.pgexplorer.com
> Tom,
>
> > Yes, you're right. Apparently I have /r/n newlines, plus a ZL string
> > in the last field indicating Null. I know that there's a command
> > line
> > utility to convert DOS newlines into UNIX newlines; could anyone give
> > me a name?
>
> Answered my own question. The utility "dos2unix" (which is a script
> file on top of "recode") is included in most Linux distributions. It
> works as follows:
> either:
> dos2unix filename
> or:
> dos2unix filename newfilename
> ... depending on your distro.
>
> Thanks!
>
> -Josh Berkus
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2002-04-26 17:25 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-04-26 15:42 Wierd error for COPY command Josh Berkus <josh@agliodbs.com>
2002-04-26 16:11 ` Tom Lane <tgl@sss.pgh.pa.us>
2002-04-26 16:51 ` Josh Berkus <josh@agliodbs.com>
2002-04-26 17:15 ` Josh Berkus <josh@agliodbs.com>
2002-04-26 17:25 ` PG Explorer <pgmail@pgexplorer.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox