Re: implicit abort harmful?

Поиск
Список
Период
Сортировка
От Jan Wieck
Тема Re: implicit abort harmful?
Дата
Msg-id 3ED6A514.6070102@Yahoo.com
обсуждение исходный текст
Ответ на implicit abort harmful?  ("Wayne Armstrong" <wdarmst@bacchus.com.au>)
Ответы Re: implicit abort harmful?  ("Wayne Armstrong" <wdarmst@bacchus.com.au>)
Список pgsql-general
Martijn van Oosterhout wrote:
> On Sun, May 25, 2003 at 10:04:30AM +1000, Wayne Armstrong wrote:
>
>> During import of 120 thousand records from an isam file system, 3 say records
>>fail integrity checks ( files in non-database systems tend not to have
>>referential integrity implemented on them except at an application level
>>(meaning not at all :). The desired result is to drop the records failing
>>integrity checks.
>
>
> Yes, I have that problem too. I actually wrote a script that took an input
> file and automatically reissued queries that succeeded but got rolled-back.
> I called it quickloader.pl :)
>
> Probably the biggest problem is that you can't use COPY to load the data.
> I've thought about loading into another table and transferring later but I
> havn't sorted out the details.

The general idea would be to setup a table that has exactly the same
structure as the final target table, but with no constraints at all. As
long as your data passes all input functions you can even COPY it in.

Now you run check queries that show you all tuples in that staging table
that would fail constraints on the final table. Fix those and you can do

     INSERT INTO final SELECT * FROM staging;

If step one fails because of data that doesn't pass the input functions
of our data types, you have to go through another level of staging with
a table that has text fields only and move it by explicit casting after
cleaning up those problems.


Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #


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

Предыдущее
От: Mark Kirkwood
Дата:
Сообщение: Re: change log 7.3.3
Следующее
От: DeJuan Jackson
Дата:
Сообщение: Re: CURRENT_DATE and CURRENT_TIME return incorrect values