Assume that Allen creates two objects: a table named Allen.BaseTable, and a view on that table named Allen.ViewA. The system verifies that Allen has SELECT privilege on Allen.BaseTable when ViewA is created.
Also assume that Allen grants the SELECT privilege on ViewA to Bobby. Bobby then creates Bobby.ViewB, which references Allen.ViewA. The Parser verifies that Bobby has SELECT privilege on Allen.ViewA when Bobby.ViewB is created.
The following stages summarize this process:
- Allen creates the base table Allen.BaseTable.
- Allen creates the view Allen.ViewA that references Allen.BaseTable.
He has the SELECT privilege on Allen.BaseTable.
- Allen grants the SELECT privilege on Allen.ViewA to Bobby.
- Bobby creates Bobby.ViewB that references Allen.ViewA.
Bobby has the SELECT privilege on Allen.ViewA.
Bobby now wants to grant the SELECT privilege on Bobby.ViewB to Chuck. Bobby can grant the privilege to Chuck, but Chuck cannot use the views in a query unless Allen grants Bobby the SELECT privilege on Allen.ViewA WITH GRANT OPTION.
The same privilege is required when a macro references an object owned by a user other than its creator. For example, assume that the macro Bobby.MacroB deletes rows from Allen.ViewA.
Other users cannot execute Bobby.MacroB unless Bobby has the EXECUTE privilege WITH GRANT OPTION on Bobby.MacroB.