Re: How to notice column changes in trigger

Поиск
Список
Период
Сортировка
От Andreas Pflug
Тема Re: How to notice column changes in trigger
Дата
Msg-id 3E6E026C.4090407@web.de
обсуждение исходный текст
Ответ на Re: How to notice column changes in trigger  (Aspire Something <sank89@sancharnet.in>)
Список pgsql-sql
Aspire Something wrote:
> Hello Christoph Haller ,
> 
> 
> 
>>>>So you want the trigger executed only if assignments to b and/or c do
> 
> 
> Do sime thing like this  use if /then /esle s block for the problem
> 
> In the first if blick check that b and c is null by the declaration of 
> IS NULL after that you run the update command as required 
> 
> The program code will show as
> 
> create function 
> CREATE FUNCTION BLAH_FUNCTION() RETURNS "trigger"
>     AS ' 
> usual blah blah of declre and all ,
> 
> 
> IF NEW.b IS NULL and NEW.C IS NULL THEN
> ROCK BABY
> ELSE
> Do OTHERWISE
> END IF;
> more blah blah plpgsql';
> 
> 
Sorry,
this won't work at all.
The NEW will contain the new row contents, and that may well be non-null 
for columns not mentioned in the update query. This kind of code will 
perform well on inserts, but not on updates of well-populated rows.
Core SQL or PL/PGSQL statements won't do the job.

Regards,
Andreas




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

Предыдущее
От: Christoph Haller
Дата:
Сообщение: Re: Special characters in SQL queries
Следующее
От: Terry Lee Tucker
Дата:
Сообщение: Novice needs help