Re: Query on exception handling in PL/pgSQL
| От | Tom Lane |
|---|---|
| Тема | Re: Query on exception handling in PL/pgSQL |
| Дата | |
| Msg-id | 10529.1101496012@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Query on exception handling in PL/pgSQL (diya das <diyadas@yahoo.com>) |
| Ответы |
Re: Query on exception handling in PL/pgSQL
|
| Список | pgsql-general |
diya das <diyadas@yahoo.com> writes:
> My pgsql function
> does an insert to a table and I have opened a
> transaction block before calling my function from the
> client. When the insert operation fails due to unique
> key violation the whole transaction aborts. Is there a
> way I can handle this error in my pgsql funtion rather
> that aborting and not executing the rest of the
> operations?
Not before PG 8.0. In earlier versions you might be able to work around
the problem by testing for existence of the target key before you
insert; though this has obvious race-condition problems if you expect
multiple clients to be doing it simultaneously.
regards, tom lane
В списке pgsql-general по дате отправления: