It´s true, but why dont it trigger any error message?
It should raise and rollback, right?
It is seeming a bug, what do you think?
Cristian
----- Original Message -----
From: "Stephan Szabo" <sszabo@megazone23.bigpanda.com>
To: "Cristian Custodio" <crstian@terra.com.br>
Cc: <pgsql-general@postgresql.org>
Sent: Friday, February 21, 2003 3:33 PM
Subject: Re: [GENERAL] Mutating table (urgent)
On Fri, 21 Feb 2003, Cristian Custodio wrote:
> 3) Creating trigger on principal table
> CREATE OR REPLACE FUNCTION TR_AIPAI() RETURNS OPAQUE AS '
> BEGIN
> INSERT INTO FILHO (CODPAI, NOMFIL) VALUES (NEW.CODPAI, ''FILHO DO
PAI''||NEW.CODPAI);
> RETURN NULL;
> END;
> ' language 'plpgsql';
>
> CREATE TRIGGER AIPAI AFTER INSERT ON PAI FOR EACH ROW EXECUTE
PROCEDURE TR_AIPAI();
>
> If we taking a insert on principal table it will insert on child table,
> until here, thats all right...
>
> 4) Create a trigger on child table that make a select on principal table
> CREATE OR REPLACE FUNCTION TR_SELECT_PAI() RETURNS OPAQUE AS'
> DECLARE I INTEGER;
> BEGIN
> SELECT COUNT(*) INTO I FROM PAI;
> RETURN NULL;
> END;
> 'language 'plpgsql';
>
> CREATE TRIGGER BIFILHO BEFORE INSERT ON FILHO FOR EACH ROW EXECUTE
PROCEDURE TR_SELECT_PAI();
By returning NULL in a BEFORE trigger you're saying to drop the request on
the floor.
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)