Re: error handling

Поиск
Список
Период
Сортировка
От Oscar Rodriguez Fonseca
Тема Re: error handling
Дата
Msg-id 20060427172808.5d4dbe9b@vrlap.localvrnet
обсуждение исходный текст
Ответ на Re: error handling  (Terry Lee Tucker <terry@esc1.com>)
Список pgsql-novice
> --> I have a table with an UNIQUE constraint. Is it possible to have
> --> something like a trigger (or error handler) which is called every time
> --> a insert statement would break this constraint?  Or in some simple cases
> --> that this record is just dropped silently, without reporting an error?

> I believe that a UNIQUE constraint will stop the insert before any trigger
> ever fires. Maybe someone else knows for sure.

I do not know if there is an specific error handler built in postgresql (besides error-codes).

If you break the unique constraint an error will be thrown. A
workaround may be to launch a trigger BEFORE the insertion and do whatever is necessary within the trigger.

http://www.postgresql.org/docs/8.1/static/sql-createtrigger.html

--
Oscar

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

Предыдущее
От: Terry Lee Tucker
Дата:
Сообщение: Re: error handling
Следующее
От: "Christian Hofmann"
Дата:
Сообщение: Getting the indexes of a table