Re: insert continue on error

Поиск
Список
Период
Сортировка
От Raymond O'Donnell
Тема Re: insert continue on error
Дата
Msg-id 471530CC.40108@iol.ie
обсуждение исходный текст
Ответ на insert continue on error  (Tom Hart <tomhart@coopfed.org>)
Список pgsql-general
On 16/10/2007 20:37, Tom Hart wrote:

> What I'd like to know is if there's a way to have postgresql still
> insert the other rows, and either bounce the bad row to another table,
> or log the error in another table/file. I'm sure there's a way to do
> this, but I'm still pretty new to postgresql.

If you do the insertions within a pl/pgsql function, you can use an
EXCEPTION block to handle the error whatever way you like - have a look
here:

http://www.postgresql.org/docs/8.2/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING

There are a couple of useful examples.

HTH,

Ray.

---------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
---------------------------------------------------------------

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

Предыдущее
От: Raymond O'Donnell
Дата:
Сообщение: Re: Preserving view source code
Следующее
От: "Scott Marlowe"
Дата:
Сообщение: Re: need help with rebuilding postgresql