I have the following trigger that checks if space used > quota and increments the quota by 5. The quota is successfully incremented but the RAISE NOTICE does not appear on the screen.
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();
Help please.
Do this, before you execute the function..
SET client_min_messages TO NOTICE;
... and then check the Messages tab if using pgAdmin
Check the value for client_min_messages in your session - it should be NOTICE or later to see notices.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With