Re: unique & update

Поиск
Список
Период
Сортировка
От Gregory Wood
Тема Re: unique & update
Дата
Msg-id 02a001c1aa8d$3ec45750$7889ffcc@comstock.com
обсуждение исходный текст
Ответ на Re: unique & update  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-general
> How can I rollback in a function ?
> I mean after update has been done, I do some checking in the Function and
> then decide that I want to quit and rollback all what inserted/updated in
> the start of the function ?

Just do:
  RAISE EXCEPTION ''I did some checking, and decided to quit and rollback'';

> Also if I attach trigger that check column uniqueness to an update will it
> check it per updated row or at the end of the action after all the table
got
> updated ?

By default, it checks after the row was updated, but you can make it
INITIALLY DEFERRED which will wait until after the transaction to check. To
be honest, I'm not sure if you have to declare it DEFERRABLE as well, or if
the INITIALLY DEFERRED will handle both.

Greg


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

Предыдущее
От: "Ben-Nes Michael"
Дата:
Сообщение: Re: unique & update
Следующее
От: "Gregory Wood"
Дата:
Сообщение: Drop Foreign Key