PostgreSQL - Triggers in PostgreSQL
Given this trigger function to prevent negative prices:
CREATE FUNCTION check_price() RETURNS trigger AS $$ BEGIN IF NEW.price < 0 THEN RAISE EXCEPTION 'Price cannot be negative'; END IF; RETURN NEW; END; $$ LANGUAGE plpgsql;What happens if you try to insert a row with price = -5?
