Re: plpgsql lacks generic identifier for record in triggers...

From: Weiping <laser(at)qmail(dot)zhengmai(dot)net(dot)cn>
To:
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: plpgsql lacks generic identifier for record in triggers...
Date: 2004-11-25 10:32:27
Message-ID: 41A5B4BB.5030306@qmail.zhengmai.net.cn
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers


>
> db=# CREATE FUNCTION schma.tbl_ins_upd() RETURNS TRIGGER AS 'BEGIN
> EXECUTE public.mc_init();
> EXECUTE public.mc_delete(''mc_key'');
> RETURN NEW;
> END;' LANGUAGE 'plpgsql';
> db=# CREATE FUNCTION schma.tbl_del() RETURNS TRIGGER AS 'BEGIN
> EXECUTE public.mc_init();
> EXECUTE public.mc_delete(''mc_key'');
> RETURN OLD;
> END;' LANGUAGE 'plpgsql';

could this be used?

CREATE FUNCTION schma.tbl_ins_upd() RETURNS TRIGGER AS 'BEGIN

EXECUTE public.mc_init();
EXECUTE public.mc_delete(''mc_key'');
if TG_OP = ''INSERT'' or TG_OP = ''UPDATE'' then
RETURN NEW;
else
RETURN OLD;
end if;
END;' LANGUAGE 'plpgsql';

regards

Laser

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-11-25 16:25:34 Re: interval conversion bug
Previous Message Mehul Doshi-A20614 2004-11-25 09:00:52 Installation fails for postgresql-8.0.0-beta4 on WindowsXP SP1

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Huxton 2004-11-25 11:24:36 Re: [HACKERS] Help!
Previous Message Richard Huxton 2004-11-25 09:54:53 Re: [HACKERS] Help!