Using PostgreSQL.
Had a trigger which does something after delete and made a rule which stopped delete from happening if something will be true.
My question is: will the rule prevent the trigger from occurring as well?
The trigger definition:
CREATE TRIGGER wypo AFTER INSERT ON "Wyp" FOR EACH ROW EXECUTE PROCEDURE funk_wyp();
The trigger function
CREATE OR REPLACE FUNCTION funk_wyp() RETURNS TRIGGER AS '
DECLARE
dodatek real := (SELECT f.cena FROM filmy f WHERE f.ID = NEW.co);
BEGIN
UPDATE "zyskiklient"
SET "ile" = ile + dodatek
WHERE kto = NEW.kto;
UPDATE "istotnoscklienta"
SET "poziom" = (SELECT poziom(NEW."kto"))
WHERE "kto" = NEW.kto;
RETURN NEW;
END;
' LANGUAGE 'plpgsql';
The rule:
CREATE OR REPLACE RULE zasada_delete_konto
AS ON DELETE TO "konto"
WHERE konto_zwrocone(OLD."ID") = FALSE
DO INSTEAD NOTHING;