Re: error handling unique key constraint in pgsql

Поиск
Список
Период
Сортировка
От Dinesh
Тема Re: error handling unique key constraint in pgsql
Дата
Msg-id 484EF82F.8080500@mongonet.net
обсуждение исходный текст
Ответ на Re: error handling unique key constraint in pgsql  ("Alex Hunsaker" <badalex@gmail.com>)
Список pgsql-admin
Great. That's what I was looking for. Thanks a lot guys.

Dinesh

Alex Hunsaker wrote:
> On Tue, Jun 10, 2008 at 2:46 PM, Dinesh <dbhandary@mongonet.net> wrote:
>
>> Hi Scott,
>>
>> Thanks for your reply.
>>
>> Is there a built in exception in pl/pgsql ( similar to oracle's
>> |DUP_VAL_ON_INDEX ) that I can use?
>>
>> I ran into an unique situation a couple of days ago. Procedure that inserts
>> a new value into unique index column was called at the same time. I even
>> check if the value exist before inserting, but one of the instance of the
>> function gave me an unique constraint violation error.
>>
>> My code looks like this:
>>
>> select into var * from table;
>>
>> if not found then
>> insert into table
>> values (a);
>> end if;
>> |
>> I would imagine the postgres db would inherently handle situation like this,
>> but it did not.
>>
>> Thanks.
>>
>
>
> See http://www.postgresql.org/docs/8.3/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING,
> specifically  example Example 38-1.
>
>


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

Предыдущее
От: "Alex Hunsaker"
Дата:
Сообщение: Re: error handling unique key constraint in pgsql
Следующее
От: "Igniris Valdivia Baez"
Дата:
Сообщение: I want to delete mi account in the mail list