Re: row not deleted but updated (trigger?)
От | Ivan Sergio Borgonovo |
---|---|
Тема | Re: row not deleted but updated (trigger?) |
Дата | |
Msg-id | 20090227132149.538720d5@dawn.webthatworks.it обсуждение исходный текст |
Ответ на | row not deleted but updated (trigger?) (Ivan Sergio Borgonovo <mail@webthatworks.it>) |
Список | pgsql-sql |
On Fri, 27 Feb 2009 12:56:06 +0100 Ivan Sergio Borgonovo <mail@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
В списке pgsql-sql по дате отправления: