Re: Help with trigger

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: Help with trigger
Дата
Msg-id 20041008140206.GA60144@winnie.fuhr.org
обсуждение исходный текст
Ответ на Re: Help with trigger  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-novice
On Fri, Oct 08, 2004 at 12:52:52AM -0600, Michael Fuhr wrote:

> The trigger function below, fired after inserts and updates, might
> be close to what you need.  However, it doesn't enforce the 2-tuple
> limit -- it only contains the logic to delete records based on the
> criteria you specified.  It worked in the minimal tests I performed,
> but I'd recommend doing more thorough testing before using it in
> production.

I should also point out that the trigger function I posted doesn't
deal with concurrency.  For example, if an update happens in one
transaction, and an insert happens in another transaction before
the update commits, then you could end up with two records that
should have been deleted but weren't.  The function I posted was
merely to show how one might perform the tests you need to make.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

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

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: Help with trigger
Следующее
От: "Keith Worthington"
Дата:
Сообщение: how to stop postmaster