Re: i have a big trouble

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sandis Jerics <sandis(at)mediaparks(dot)lv>
Cc: pgsql sql Mailing List <pgsql-sql(at)postgresql(dot)org>
Subject: Re: i have a big trouble
Date: 2001-01-24 15:45:43
Message-ID: 12386.980351143@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Sandis Jerics <sandis(at)mediaparks(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Davis 2001-01-24 15:49:30 RE: SQL Query Results
Previous Message Tom Lane 2001-01-24 15:34:29 Re: How to change the ownership of the table?