Re: error handling unique key constraint in pgsql

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: error handling unique key constraint in pgsql
Дата
Msg-id dcc563d10806101209x4edfd77dl28bf514a0742d845@mail.gmail.com
обсуждение исходный текст
Ответ на error handling unique key constraint in pgsql  (Dinesh <dbhandary@mongonet.net>)
Ответы Re: error handling unique key constraint in pgsql  (Dinesh <dbhandary@mongonet.net>)
Список pgsql-admin
On Tue, Jun 10, 2008 at 10:52 AM, Dinesh <dbhandary@mongonet.net> wrote:
> Hi All,
>
> I was wondering if there is an easy way to handle unique key constraint in
> pgsql. Right now my entire transaction aborts if it tries to insert
> duplicate keys, but I would like to handle this
> scenario in such a way that the transaction will not break.
>
> Please let me know if you have done something like this. I greatly
> appreciate your help.

There are a couple of approaches:

process the inserts in a pl/pgsql function  and use the exception
handling in there to catch them.

Use savepoints.

Both of these use the same underlying mechanisms, and both tend to be
expensive in terms of overhead.

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

Предыдущее
От: Dinesh
Дата:
Сообщение: error handling unique key constraint in pgsql
Следующее
От: "Scott Marlowe"
Дата:
Сообщение: Re: what happend to my database