Re: Trigger once again

Поиск
Список
Период
Сортировка
От Tariq Muhammad
Тема Re: Trigger once again
Дата
Msg-id Pine.LNX.4.21.0211281736470.21997-100000@genesis.int.libertyrms.com
обсуждение исходный текст
Ответ на Trigger once again  (Adrian Klaver <aklaver@attbi.com>)
Список pgsql-general
On Thu, 28 Nov 2002, Adrian Klaver wrote:

> The trigger seems to work to well. If I update values other than the
> tag_number I get the 'Number is already present' message. I am somewhat
> confused as their is no new.tag_number value being passed to the function.
> Can anyone set me straight?

Try it by validating 2 columns, that should do the trick:

 CREATE OR REPLACE FUNCTION validate_tag_number()
       RETURNS OPAQUE AS '
     BEGIN
       IF new.tag_number=old.tag_number and new.other_column=old.other_column THEN
        RAISE EXCEPTION ''Tag is already present '';
       END IF;
        RETURN NEW;
     END;
       'LANGUAGE 'plpgsql';

If that doesn't work then send me the schema of your table and I will work
on it.

Tariq Muhammad
Liberty RMS
tariq@libertyrms.info
v:416-646-3304 x 111
c:416-993-1859
p:416-381-1457



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

Предыдущее
От: Holger Klawitter
Дата:
Сообщение: Re: Why does everyone think MySQL is easier?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Trigger once again