0

Let's say I have a permissions to update a view, where the view is:

create view v as select * from Student where major like '%Engineering%'.

I don't have permissions to modify or view any student whose major does not contain the word "Engineering." Should I be allowed to insert into this view even if the major of the student I'm inserting is 'Biology'? Would the view propagate to the base relation?

4

2 回答 2

1

It depends on the database engine and how the view was created.

Your original view definition will allow Oracle and SqlServer users to insert a view row that the user cannot see, and or update a view row such that a row can no longer be seen.

But you can add the WITH CHECK OPTION to the view in Oracle and SqlServer to prevent users from inserting or updating a view row such that the result is not visible:

create view v as select * from Student where major like '%Engineering%' with check option;
于 2012-08-15T23:54:12.820 回答
0

I've just tried it on SQL Server 2008 - the inserted row does propagate to the underlying table. Obviously you won't be able to see your new row when selecting from your view though.

于 2012-08-15T23:20:25.487 回答