En, sentencia DROP TRIGGER
DROP TRIGGER [IF EXISTS] trigger_name ON table_name [ CASCADE | RESTRICT ];
Analicemos la sintaxis anterior:
- GATILLO DE CAÍDA
- SI EXISTE SI EXISTE SI EXISTE
- la CASCADAla CASCADA
- RESTRICTDROP TRIGGERRESTRICT
CREATE FUNCTION check_staff_user() RETURNS TRIGGER AS $$ BEGIN IF length(NEW.username) < 8 OR NEW.username IS NULL THEN RAISE EXCEPTION 'The username cannot be less than 8 characters'; END IF; IF NEW.NAME IS NULL THEN RAISE EXCEPTION 'Username cannot be NULL'; END IF; RETURN NEW; END; $$ LANGUAGE plpgsql;
personal
CREATE TRIGGER username_check BEFORE INSERT OR UPDATE ON staff FOR EACH ROW EXECUTE PROCEDURE check_staff_user();
en
DROP TRIGGERusername_check
DROP TRIGGER username_check ON staff;
Publicación traducida automáticamente
Artículo escrito por RajuKumar19 y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA