Re: i have a big trouble

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: i have a big trouble
Дата
Msg-id 12386.980351143@sss.pgh.pa.us
обсуждение исходный текст
Ответ на i have a big trouble  (Sandis Jerics <sandis@mediaparks.lv>)
Список pgsql-sql
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
ArmedForces. 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


В списке pgsql-sql по дате отправления:

Предыдущее
От: Attila Kevei
Дата:
Сообщение: select returns no line
Следующее
От: Tom Lane
Дата:
Сообщение: Re: How to change the ownership of the table?