On 5/25/05, Sebastian Böck <sebastianboeck@xxxxxxxxxx> wrote: > >>CREATE OR REPLACE FUNCTION upd (view_test) RETURNS VOID AS $$ > >> DECLARE > >> NEW ALIAS FOR $1; > >> BEGIN > >> RAISE NOTICE 'UPDATE'; > >> UPDATE test SET test = NEW.test WHERE id = OLD.id; > >> UPDATE join1 SET text1 = NEW.text1 WHERE id = OLD.id; > >> UPDATE join2 SET text2 = NEW.text2 WHERE id = OLD.id; > >> UPDATE join3 SET text3 = NEW.text3 WHERE id = OLD.id; > >> RETURN; > >> END; > >>$$ LANGUAGE plpgsql; > > > > > > Control question, I didn't check it, but would it be enough to change from: > > UPDATE join1 SET text1 = NEW.text1 WHERE id = OLD.id; > > to: > > UPDATE join1 SET text1 = NEW.text1 WHERE id = OLD.id AND text1 <> NEW.text1? > > > > ... I may be wrong. :) > > Yes, thats more elegant then my other (4th) solution. > Was late yesterday evening ;) Be wary of the NULL values though. :) Either don't use them, add something like 'AND (text1 <> NEW.text1 OR text1 IS NULL OR NEW.text1 IS NULL)' or something more complicated. :) Regards, Dawid ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your message can get through to the mailing list cleanly