无法更新 postgresql 中的过程
can't update a procedure in postgresql
我尝试在psql中更新一个过程,代码没有报错:
CREATE OR REPLACE FUNCTION public.decrement_user_followers()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN
UPDATE users SET unit_followers = unit_followers - 1 WHERE id = OLD.user_id_followed;
UPDATE users SET unit_following = unit_following - 1 WHERE id = OLD.user_id_follower;
RETURN OLD;
END $function$
但是当我尝试查看更改时 \df+ decrement_user_followers
给了我旧代码。
有什么建议吗?
“;”结尾不见了……啊啊
CREATE OR REPLACE FUNCTION public.decrement_user_followers()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN
UPDATE users SET unit_followers = unit_followers - 1 WHERE id = OLD.user_id_followed;
UPDATE users SET unit_following = unit_following - 1 WHERE id = OLD.user_id_follower;
RETURN OLD;
END $function$;
我尝试在psql中更新一个过程,代码没有报错:
CREATE OR REPLACE FUNCTION public.decrement_user_followers()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN
UPDATE users SET unit_followers = unit_followers - 1 WHERE id = OLD.user_id_followed;
UPDATE users SET unit_following = unit_following - 1 WHERE id = OLD.user_id_follower;
RETURN OLD;
END $function$
但是当我尝试查看更改时 \df+ decrement_user_followers
给了我旧代码。
有什么建议吗?
“;”结尾不见了……啊啊
CREATE OR REPLACE FUNCTION public.decrement_user_followers()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN
UPDATE users SET unit_followers = unit_followers - 1 WHERE id = OLD.user_id_followed;
UPDATE users SET unit_following = unit_following - 1 WHERE id = OLD.user_id_follower;
RETURN OLD;
END $function$;