我使用的是Oracle 11.2.0.2.0:
作为用户u1:
create table t(a int);
grant select on t to u2;作为用户u2:
create view v as select * from u1.t;
create trigger tr instead of update on v for each row begin null; end;
update v set a = null;以u2格式执行update语句的结果:
Expected: 0 rows updated.
Actual: ORA-01031: insufficient privileges为什么u2会得到ORA-01031?它没有尝试更新t中的数据。我的解决方法是什么?我不想让u2在t上更新pivileges。
谢谢,阿尔
发布于 2016-06-20 14:09:10
http://psoug.org/definition/authid.htm
请注意,对于视图或触发器中引用的调用者权限例程,这些对象的所有者始终被视为调用者,而不是触发它的用户。
这意味着如果您使用触发器,那么将使用current_user authid调用该过程。update触发器本身需要update priv,因为它检查user1中的表的update。
对我来说,这是一个错误,因为最终user2模式中视图的instead of触发器与user1的update priv没有必然的关系。
https://stackoverflow.com/questions/27229953
复制相似问题