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