Re: [GENERAL] Trigger or Rule?

Поиск
Список
Период
Сортировка
От Adriaan Joubert
Тема Re: [GENERAL] Trigger or Rule?
Дата
Msg-id 37246B24.6C4BC4C3@albourne.com
обсуждение исходный текст
Ответ на Trigger or Rule?  (Andy Lewis <alewis@themecca.net>)
Список pgsql-general
>
> select count(*) into cnt from <tablename> where new.<key> = key;
> if (cnt>0) then
>         delete from <tablename> where key = new.<key>
> end if
>

Just looked at this, and this is not actually what you wanted. If you do
not want to replace the old row, do something along the lines

RAISE EXCEPTION ''Duplicate entry''

which will abort the insert. It's all in the manual.

Adriaan

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

Предыдущее
От: Adriaan Joubert
Дата:
Сообщение: Re: [GENERAL] Trigger or Rule?
Следующее
От: Statistical Solutions
Дата:
Сообщение: Re: [GENERAL] advice on buying sun hardware to run postgres