我在PostgreSQL中创建此触发器时遇到错误
DROP TRIGGER IF EXISTS districts_bdt ON districts CASCADE;
CREATE OR REPLACE FUNCTION trigger_fct_districts_bdt()
RETURNS trigger
AS $BODY$
BEGIN
DELETE GROUPS WHERE ID = OLD.UF_GROUP_ID;RETURN OLD;
END$BODY$
LANGUAGE'plpgsql' SECURITY DEFINER;
-- REVOKE ALL ON FUNCTION trigger_fct_districts_bdt() FROM PUBLIC;
CREATE TRIGGER districts_bdt
BEFORE DELETE ON districts FOR EACH ROW
EXECUTE PROCEDURE trigger_fct_districts_bdt();
这是我的错误
ERROR: syntax error at or near "GROUPS"
LINE 4: DELETE GROUPS WHERE ID = OLD.UF_GROUP_ID;
答案 0 :(得分:1)
它应该是"从群组中删除......"而不是" DELETE GROUPS ..."在第4行。