Case Study: Granting SELECT on a View - Advanced SQL Engine - Teradata Database

SQL Data Control Language

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
lmb1556233084626.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1149
lifecycle
previous
Product Category
Teradata® Vantage™ NewSQLEngine

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:

  1. Allen creates the base table Allen.BaseTable.
  2. Allen creates the view Allen.ViewA that references Allen.BaseTable.

    He has the SELECT privilege on Allen.BaseTable.

  3. Allen grants the SELECT privilege on Allen.ViewA to Bobby.
  4. 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.