Re: Mutating table (urgent)
От | Cristian Custodio |
---|---|
Тема | Re: Mutating table (urgent) |
Дата | |
Msg-id | 001301c2d9db$6a9f3880$fb01a8c0@ttcristian обсуждение исходный текст |
Ответ на | Re: Mutating table (urgent) (Stephan Szabo <sszabo@megazone23.bigpanda.com>) |
Ответы |
Re: Mutating table (urgent)
|
Список | pgsql-general |
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)
В списке pgsql-general по дате отправления: