Обсуждение: Problem with Function and Trigger ! Urgent !!!

Поиск
Список
Период
Сортировка

Problem with Function and Trigger ! Urgent !!!

От
"De Leeuw Guy"
Дата:
Hi all
I create this function and this trigger :
Before starting this, I start from the command prompt : createlang plpgsql
myDB

CREATE FUNCTION DelArtFather()
 RETURNS opaque
 AS '
  DELETE FROM TArticles WHERE IdArtFather = OLD.IdArt;
  RETURN OLD;
 '
 LANGUAGE 'plpgsql';

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

And I execute the query :
DELETE FROM TArticles WHERE IdArt = 1;
I Receive :
NOTICE: plpgsql: ERROR during compile of delartfather near line 1
ERROR: parse error at or near "DELETE" occured !

Any Idee ?

Guy