postgresql drop函数执行给定的函数,而不是删除触发功能
我使用以下代码创建了触发函数:
CREATE OR REPLACE FUNCTION snitch() RETURNS event_trigger AS $$
BEGIN
select pgr_createTopology('public.roads_noded', 0.001);
END;
$$ LANGUAGE plpgsql;
CREATE EVENT TRIGGER snitch ON ddl_command_start EXECUTE FUNCTION snitch();
它位于公共架构中。现在,我想删除此功能,但是当我尝试将其丢弃时,执行给定功能并悬挂服务器。重新启动服务器后,也会发生同样的事情。我无法创建或丢弃任何表。有没有办法删除此触发功能?
I created the trigger function with the below code:
CREATE OR REPLACE FUNCTION snitch() RETURNS event_trigger AS $
BEGIN
select pgr_createTopology('public.roads_noded', 0.001);
END;
$ LANGUAGE plpgsql;
CREATE EVENT TRIGGER snitch ON ddl_command_start EXECUTE FUNCTION snitch();
It is located in the public schema. Now I want to drop this function but when I try to drop it executes the given function and the server hangs. After restarting the server, the same thing happens. I can't create or drop any table. Is there a way to remove this trigger function?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
drop函数
命令本身就是一个ddl命令,因此触发器将发射。您应该首先使用删除事件触发器
,然后删除触发器。The
DROP FUNCTION
command is itself a DDL command so the trigger will fire. You should first remove the trigger usingDROP EVENT TRIGGER
, then the function.