gpt4 book ai didi

sql - 如何在 PostgreSQL 9.1 数据库中删除多个触发器

转载 作者:行者123 更新时间:2023-11-29 11:17:13 24 4
gpt4 key购买 nike

我正在尝试删除多个触发器,但出现 SQL 错误:

PG::Error: ERROR:  syntax error at or near ";"
LINE 1: DROP TRIGGER rr_admin_reports;

这是我在 rails 中执行的 sql:

sql = <<-SQL
DROP TRIGGER rr_admin_reports;
DROP TRIGGER rr_apps;
DROP TRIGGER rr_attachments;
SQL

有没有办法轻松删除一长串触发器?谢谢

最佳答案

DROP TRIGGER rr_admin_reports ON yourTable;

引自 PostgreSQL 文档:

The DROP TRIGGER statement in PostgreSQL is incompatible with the SQL standard. In the SQL standard, trigger names are not local to tables, so the command is simply DROP TRIGGER name.

http://www.postgresql.org/docs/7.4/static/sql-droptrigger.html

关于sql - 如何在 PostgreSQL 9.1 数据库中删除多个触发器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14164093/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com