Re: Create trigger problem :

From: "De Leeuw Guy" <G(dot)De_Leeuw(at)eurofer(dot)be>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Create trigger problem :
Date: 2001-03-13 09:15:30
Message-ID: 98koqq$30fd$1@news.tht.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks for your interest,
I try also this but i receive the error :

ERROR: ProcedureCreate: sql functions cnnot return type "opaque"
ERROR: CreateTrigger: Function delartfather() does not exist

here is my code :

CREATE FUNCTION DelArtFather()
RETURNS opaque
AS '
DELETE FROM TArticles WHERE IdArtFather = OLD.IdArt;
SELECT 1 AS ignore_this
'
LANGUAGE 'sql';

CREATE TRIGGER trigger_TArticles
BEFORE DELETE ON TArticles
FOR EACH ROW EXECUTE PROCEDURE DelArtFather();

"Stephan Szabo" <sszabo(at)megazone23(dot)bigpanda(dot)com> a crit dans le message
news: Pine(dot)BSF(dot)4(dot)21(dot)0103121829380(dot)98920-100000(at)megazone23(dot)bigpanda(dot)com(dot)(dot)(dot)
>
> Trigger functions need to take no arguments and return
> opaque. You can use NEW or OLD inside the function and
> arguments given in the create trigger statement
> are passed into the function in a special way (in
> plpgsql, it's TG_ARGV[] i believe)
>
> On Fri, 9 Mar 2001, De Leeuw Guy wrote:
>
> > Hi all,
> >
> > I try this :
> >
> > CREATE FUNCTION DelArtFather(INT4)
> > RETURNS INT4
> > AS '
> > DELETE FROM TArticles WHERE IdArtFather = $1;
> > SELECT 1 AS ignore_this
> > '
> > LANGUAGE 'sql';
> >
> > CREATE TRIGGER trigger_TArticles
> > BEFORE DELETE ON TArticles
> > FOR EACH ROW EXECUTE PROCEDURE DelArtFather(old.IdArt);
> >
> > and i obtain this error :
> >
> > ERROR: parse error at or near "old"
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2001-03-13 09:26:22 Re: "critical mass" reached?
Previous Message drevil 2001-03-13 09:00:44 Re: Data type for storing images?