我想分配给已经绑定了 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 不支持将触发器绑定到视图吗?
欢迎任何建议,提前谢谢