Re: row not deleted but updated (trigger?)

From: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: row not deleted but updated (trigger?)
Date: 2009-02-27 12:21:49
Message-ID: 20090227132149.538720d5@dawn.webthatworks.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, 27 Feb 2009 12:56:06 +0100
Ivan Sergio Borgonovo <mail(at)webthatworks(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Igor Neyman 2009-02-27 15:06:56 Re: row not deleted but updated (trigger?)
Previous Message Ivan Sergio Borgonovo 2009-02-27 11:56:06 row not deleted but updated (trigger?)