From: Tom Lane <tgl@sss.pgh.pa.us>
To: Sandis Jerics <sandis@mediaparks.lv>
Cc: pgsql sql Mailing List <pgsql-sql@postgresql.org>
Subject: Re: i have a big trouble
Date: Wed, 24 Jan 2001 10:45:43 -0500
Message-ID: <12386.980351143@sss.pgh.pa.us> (raw)
In-Reply-To: <13115267721.20010124135004@mediaparks.lv>
References: <3A6EAEEC.B294361D@ualg.pt>
<13115267721.20010124135004@mediaparks.lv>
Sandis Jerics <sandis@mediaparks.lv> writes:
> www_mod_lv=> \copy news from '/home/sites/www.mod.lv/web/news.sql'
> \.
> ERROR: copy: line 2, pg_atoi: error in "
> At the international humanitarian mission of KFOR the Latvian unit participates with 10 soldiers from the National Armed Forces. The KFOR Latvian contingent - Military Police and medical units - will operate within the contingent of UK. "
Notice that the complaint is from pg_atoi, so the problem is that the
given text is being taken as an integer field --- that is, as the start
of a new row of data. I suspect what is happening is that the embedded
newlines in your text column are getting munged up so that they look
like ordinary newlines (end of a data row) to COPY.
A newline that is part of the data, and not a row separator, has to be
represented as a backslash followed by a newline (\n) character.
Anything that messes this up will confuse COPY. One theory that comes
to mind is that you edited the dump file with an editor that converts
Unix-style newlines (\n) to DOS-style (\r\n). Then your embedded
newlines would become backslash \r \n ... in other words, a quoted \r
followed by a regular end-of-row marker.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, sandis@mediaparks.lv
Subject: Re: i have a big trouble
In-Reply-To: <12386.980351143@sss.pgh.pa.us>
References: <3A6EAEEC.B294361D@ualg.pt> <13115267721.20010124135004@mediaparks.lv> <12386.980351143@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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