postgresql drop函数执行给定的函数,而不是删除触发功能

发布于 2025-01-25 21:29:43 字数 377 浏览 1 评论 0原文

我使用以下代码创建了触发函数:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

疯狂的代价 2025-02-01 21:29:43

drop函数命令本身就是一个ddl命令,因此触发器将发射。您应该首先使用删除事件触发器,然后删除触发器。

The DROP FUNCTION command is itself a DDL command so the trigger will fire. You should first remove the trigger using DROP EVENT TRIGGER, then the function.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文