I have a View that has several fields.
When i INSERT INTO
a view I run a function based on INSERT
parametrs. The function returns a value.
How can I retrieve The value from rule?
INSERT RETURNING
Gives me:
ERROR: cannot perform INSERT RETURNING on relation "full_subntes"
HINT: You need an unconditional ON INSERT DO INSTEAD rule with a RETURNING clause.
Example:
CREATE TABLE test (
a VARCAHR primary key,
b VARCHAR,
);
CREATE VIEW test_v AS SELECT * FROM test;
CREATE OR REPLACE RULE Test_v_Insert AS ON INSERT TO Test_v
DO INSTEAD (
SELECT myFunction('param');
);
INSERT INTO test_v(a, b) VALUES ('a', 'b') RETURNING a, b;
Then I get an error described above.