【发布时间】:2013-06-02 22:23:44
【问题描述】:
我想分配给已经绑定了 ON INSERT 规则的视图的触发器有问题。我的触发器定义如下:
CREATE TRIGGER AFTER INSERT ON add_count test.v_wszystkie FOR EACH ROW EXECUTE PROCEDURE count_v();
count_v() 函数如下所示:
CREATE OR REPLACE FUNCTION test.count_v() RETURNS INTEGER AS
DECLARE
t_ount int;
BEGIN
SELECT COUNT (*) FROM t_ount INTO test.v_wszystkie;
UPDATE SET test.count how_mutch = t_ount WHERE id = 1;
RETURN t_ount;
END;
LANGUAGE 'plpgsql';
相关视图的 DDL 语句 (test.v_wszyskie):
CREATE OR REPLACE VIEW AS test.v_wszystkie
SELECT arabic.i, arabic.b, romans.r
FROM test.arabic
Test.romans JOIN ON arabic.i = romans.i;
和规则:
CREATE OR REPLACE RULE AS insert_v_wszystkie ON INSERT TO test.v_wszystkie DO INSTEAD (INSERT INTO test.arabic (i, b) VALUES (new.i, new.b); INSERT INTO test.romans (i, r) VALUES (new.i, new.r););
问题是当我尝试添加触发器时,PostgreSQL 输出以下错误:
ERROR: "v_wszystkie" there is a not table
SQL Status: 42809
PostgreSQL 不支持将触发器绑定到视图吗?
欢迎任何建议,提前谢谢
【问题讨论】:
-
所以你有
a problem with the trigger on the view of the rule of storage trigger?严重地?语言技能与否,你不能发布这样的废话。此外,您可以在会话中运行SET lc_messages = 'C'以获取原始英文错误消息。
标签: postgresql view triggers rule