row not deleted but updated (trigger?) - Mailing list pgsql-sql

From Ivan Sergio Borgonovo
Subject row not deleted but updated (trigger?)
Date
Msg-id 20090227125606.73d48d8e@dawn.webthatworks.it
Whole thread Raw
Responses Re: row not deleted but updated (trigger?)
Re: row not deleted but updated (trigger?)
List pgsql-sql
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;

create trigger FT1IDX_catalog_brands_update_trigger before update or
delete on catalog_brands for each row execute procedure
FT1IDX_catalog_brands_update();

I do something
update catalog_brands set name='zzz' where brandid=1234;
1 row get updated.

When I do
delete from catalog_brands where brandid=1234;
no row get deleted and no error get reported.

what did I miss?

thanks

-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it



pgsql-sql by date:

Previous
From: Steve Midgley
Date:
Subject: Re: Best practices for geo-spatial city name searches?
Next
From: Ivan Sergio Borgonovo
Date:
Subject: Re: row not deleted but updated (trigger?)