error tolerant inserting of data

Поиск
Список
Период
Сортировка
От Jules Alberts
Тема error tolerant inserting of data
Дата
Msg-id 20030305141807.8A7781CB1A5@koshin.dsl.systemec.nl
обсуждение исходный текст
Ответы Re: error tolerant inserting of data  ("Nigel J. Andrews" <nandrews@investsystems.co.uk>)
Список pgsql-general
Hello everybody,

I'm working on a new pg database that will contain all data that's
currently in our old system. The data is already in the db, in tables
with names like import_table1, import_table2 etc., now I have to
transfer them to the real tables. The real tables have some
constraints, like trigger functions to prevent overlapping date-
periods.

I have written pl/pgsql code to do the importing bit, but there is one
big drawback: as soon as anything in a function (or in a FOR ... SELECT
... LOOP) goes wrong, everything is rolled back. Normally this
behaviour would be fine, but not in this situation, because my old data
contains rows sometimes conflicts with the constraints.

What I want is all conflicting rows to be not imported, just plainly be
refused, and let everything that's OK be imported. What is the best way
to do this?

TIA!

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

Предыдущее
От: Laurent Perez
Дата:
Сообщение: bug ? updates and insert crash the backend
Следующее
От: Tom Lane
Дата:
Сообщение: Re: foreign key constraint