On Fri, 27 Feb 2009 12:56:06 +0100 Ivan Sergio Borgonovo <m...@webthatworks.it> wrote:
> I've: > > create or replace function FT1IDX_catalog_brands_update() returns > trigger as $$ > begin > if(TG_OP='DELETE') then > update catalog_items set > FT1IDX=GetFTIDX('pg_catalog.english', Code, CodeAlt, ISBN, > Name, Authors, '') > where BrandID=old.BrandID; > else > if(coalesce(new.Name,'')<>coalesce(old.Name,'')) then > update catalog_items set > FT1IDX=GetFTIDX('pg_catalog.english', Code, CodeAlt, ISBN, > Name, Authors, new.Name) > where BrandID=new.BrandID; > end if; > end if; > return new; > end $$ language plpgsql volatile; umpfs... on delete new is null... so no action take place. modified to return old on delete and new for the rest. Sorry for the noise. -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql