Using Postgres 9.6 I have 2 table, a view that joins them and a rule that inserts into both tables when you try and insert into the view.
It works fine as long as the calling code it does not use the RETURNING clause.
CREATE OR REPLACE RULE insert_my_view
AS ON INSERT TO my_view DO INSTEAD
(
INSERT INTO tableA(tableA_id, name) VALUES (NEW.tableA_id, NEW.name) RETURNING *, NEW.some_other (or maybe tableB.some_other);
INSERT INTO tableB(tableA_id, some_other) VALUES (NEW.tableA_id, NEW.some_other);
);
Is there a way to maybe make each insert return it's data and then I join the results for the overall returning statement?