PgSQL trigger on a view with storage's rule
I apologize in advance for my English; I have a problem with the trigger on the view of the rule of storage trigger looks like this:
CREATE TRIGGER AFTER INSERT ON add_count test.v_wszystkie FOR EACH ROW EXECUTE PROCEDURE count_v ();
function looks like this:
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 ';
View looks like this:
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;
and the rule:
CREATE OR REPLACE RULE AS insert_v_wszystkie ON INSERT TO DO INSTEAD test.v_wszystkie (INSERT INTO test.arabic (i, b) VALUES (new.i, new.b); INSERT INTO test.romans (i, r) VALUES (new.i, new.r););
The problem is when I want to add a trigger postgres say:
ERROR: "v_wszystkie" there is a not table SQL Status: 42809
Is postgres does not allow add the trigger to the views?
thank you in advance for any suggestions
I apologize in advance for my English; I have a problem with the trigger on the view of the rule of storage trigger looks like this:
CREATE TRIGGER AFTER INSERT ON add_count test.v_wszystkie FOR EACH ROW EXECUTE PROCEDURE count_v ();
function looks like this:
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 ';
View looks like this:
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;
and the rule:
CREATE OR REPLACE RULE AS insert_v_wszystkie ON INSERT TO DO INSTEAD test.v_wszystkie (INSERT INTO test.arabic (i, b) VALUES (new.i, new.b); INSERT INTO test.romans (i, r) VALUES (new.i, new.r););
The problem is when I want to add a trigger postgres say:
ERROR: "v_wszystkie" there is a not table SQL Status: 42809
Is postgres does not allow add the trigger to the views?
thank you in advance for any suggestions
No comments:
Post a Comment