我有以下触发器检查已用空间 > 配额并将配额增加 5。配额已成功增加,但 RAISE NOTICE 未出现在屏幕上。
CREATE OR REPLACE FUNCTION checkspaceused() RETURNS TRIGGER AS $cssubscription$
DECLARE
new_spaceused INTEGER;
new_id INTEGER;
new_quota INTEGER ;
BEGIN
IF(TG_OP='UPDATE') THEN
IF NEW.spaceused > NEW.quota THEN
RAISE NOTICE 'Limit breached';
UPDATE subscription SET quota = NEW.spaceused + 5 where u_id = NEW.u_id;
END IF ;
END IF;
RETURN NEW;
END;
$cssubscription$ LANGUAGE plpgsql;
CREATE TRIGGER checkspaceused AFTER UPDATE ON subscription FOR EACH ROW EXECUTE PROCEDURE checkspaceused();
请帮忙。