在搜索了这个问题之后,不确定是否真的可以这样做,感谢您的指点。
我的观点是这样创建的:
create or replace view OutputView as
select * from view1
natural full outer join view2;
使用:
update OutputView set colA = 'undefined' where colA is null;
给出:
ERROR: cannot update view "OutputView"
DETAIL: Views that do not select from a single table or view are not automatically updatable.
HINT: To enable updating the view, provide an INSTEAD OF UPDATE trigger or an unconditional ON UPDATE DO INSTEAD rule.
到目前为止,该触发器和规则还没有成功。问题在于输出视图中的某些列具有空值,因为这些列在原始视图中不存在,例如:
view1
-----
colA colB
1 a
2 b
view2
-----
colB colC
100 x
200 y
OutputView
----------
colA colB colC
1 a null
2 b null
null 100 x
null 200 y