Re: error-tolerant COPY FROM

Поиск
Список
Период
Сортировка
От Michael Glaesemann
Тема Re: error-tolerant COPY FROM
Дата
Msg-id e5b820162eb17faf47ceb08b23294ea4@myrealbox.com
обсуждение исходный текст
Ответ на error-tolerant COPY FROM  ("Joolz" <joolz@arbodienst-limburg.nl>)
Ответы Re: error-tolerant COPY FROM  ("Joolz" <joolz@arbodienst-limburg.nl>)
Список pgsql-general
On Feb 4, 2005, at 21:32, Joolz wrote:

> What I need is an import where all valid lines from the csv files
> are read into the db, and I also get a logfile for all invalid
> lines, stating the line number plus the pg error message so I can
> see which constraint was violated.
>
> I can't think of a direct, elegant solution for this, does anyone
> have any suggestions? Thanks a lot!

I don't know if it's elegant or not, but my approach to this situation
is to read the data into a temp table that does not have as strict
constraints. Once the data is in the database, I process it further,
moving the data that's valid into the appropriate table. Then I see
what's left, and what further processing I need to do to "fix" the
invalid data. Perhaps a similar strategy would work for you.

Michael Glaesemann
grzm myrealbox com


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

Предыдущее
От: "Joolz"
Дата:
Сообщение: Re: error-tolerant COPY FROM
Следующее
От: "Joolz"
Дата:
Сообщение: Re: error-tolerant COPY FROM