Trigger with delete - Mailing list pgsql-general

From Matthias Teege
Subject Trigger with delete
Date
Msg-id 200006201306.PAA17694@moon.mteege.de
Whole thread Raw
List pgsql-general
Moin,

I want to setup a trigger that removes entries from a
related table depented an the record in the main table. So
I try the following:

CREATE FUNCTION "delete_aufpos" (int4) RETURNS int  AS '
delete from subtable where key = $1'
LANGUAGE 'SQL';

CREATE TRIGGER delete_auftrag
    BEFORE DELETE ON maintable FOR EACH ROW
    EXECUTE PROCEDURE delete_aufpos(1);

The create function gives me the following message:

ERROR: function declared to return type int4, but final
query is not a retrieve

What is the return type of 'delete'?
How can I pass the key from the main table to the sub table?

Vielen Dank
Matthias




pgsql-general by date:

Previous
From: The Hermit Hacker
Date:
Subject: New MicroSoft Worm - protect your loved ones ...
Next
From: Marc Britten
Date:
Subject: RE: Trigger with delete