Re: Separating data sets in a table

Поиск
Список
Период
Сортировка
От Andreas Tille
Тема Re: Separating data sets in a table
Дата
Msg-id Pine.LNX.4.44.0208260820060.27720-100000@wr-linux02.rki.ivbb.bund.de
обсуждение исходный текст
Ответ на Re: Separating data sets in a table  (Mark Stosberg <mark@summersault.com>)
Ответы Re: Separating data sets in a table  (Oliver Elphick <olly@lfix.co.uk>)
Список pgsql-sql
On Sun, 25 Aug 2002, Mark Stosberg wrote:

> Thanks for the clarification. Here's an idea about how to solve your
> problem. As you are importing your data, instead of doing it all at
> once, try import it a row at a time into a table that has the RI turned
> on. Check each insert to see if it's successful. It if it's not
> successful, then insert that row into a table that /doesn't/ have RI
> (maybe "import_failures"),
> perhaps also including the error that Postgres returned. (This may be
> stored in $DBH::errstr). Then when you are done, you can look in the
> import_failures for a report of which rows need some assistance. If you
> need every row to succeed that's imported into the production table, you
> can do all this inside of a transaction, and roll it back if any of the
> inserts fail. [ thinks for a moment. ] Of course, that would normally
> rollback your inserts into import_failures too, so perhaps you can use a
> second database connection to make sure those always happen.
>
> I hope that helps. Perhaps thinking in terms of "row-at-a-time
> processing" will help you solve your problem.
Well for sure this might be an option but as I said I receive the data
in the dump format apropriate to use "COPY <tablemane> FROM <file>".  Would
you really like to suggest me to split those data sets into single lines?
Moreover I'm not sure about how to catch the error messages of failed
COPY statements.

I've thought that including all data and handling them afterwards would
be agood idea and it is just my lack of SQL knowledge which prevents
me from finding a clever solution to sort the stuff out.

Kind regards
        Andreas.



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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1?
Следующее
От: David Wheeler
Дата:
Сообщение: ANNOUNCE: Bricolage 1.3.3