Examples: Granting Privileges with GRANT (SQL Form) - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Example: Granting CREATE/DROP COMPUTE GROUP Privileges

A user granting the CREATE COMPUTE GROUP privilege to the CloudDBA user.

GRANT CREATE COMPUTE GROUP TO CloudDBA;
 *** Grant accepted.

A user granting the DROP COMPUTE privilege to the CloudDBA user.

GRANT DROP COMPUTE GROUP TO CloudDBA;
 *** Grant accepted. 

A user running the MODIFY COMPUTE statement to modify the MarketingTeam group created by another user.

MODIFY COMPUTE GROUP MarketingTeam
USING Query_Strategy('STANDARD');
*** Compute Group has been modified.

Example: Granting Privileges to a Group of Users

The following request grants privileges to a group of users. In this example, all users created under the finance database are granted the privilege to SELECT data from the department table, which is in the personnel database:

GRANT SELECT
ON personnel.department
TO ALL finance;

Example: Granting Compute Profile Privileges

A user with CREATE COMPUTE PROFILE WITH GRANT OPTION granting CREATE COMPUTE PROFILE privilege to User1 user.

GRANT CREATE COMPUTE PROFILE TO User1;
 *** Grant accepted. 

The User1 user with CREATE COMPUTE PROFILE on the ShippingTeam compute group WITH GRANT Option granting CREATE COMPUTE PROFILE privilege on a compute cluster group.

GRANT CREATE COMPUTE ON ShippingTeam TO User1;
*** Grant accepted.

Example: Granting SELECT on Any Object

The following statement allows user Moffit to retrieve information from any object in the personnel database:

GRANT SELECT
ON personnel
TO moffit;

Example: Granting SELECT on One Column of a Table

This example grants the SELECT privilege only on column_1 of the table named department in the personnel database to user Moffit.

GRANT SELECT (column_1)
ON personnel.department
TO moffit;

Example: Granting SELECT, INSERT, UPDATE, and DELETE on Any Object

The following statement allows user Peterson to perform selects, inserts, updates, and deletes on any object in the personnel database:

GRANT SELECT, INSERT, UPDATE, DELETE
ON personnel
TO peterson;

Example: Granting USER Privilege On a Database

The following statement allows user Phan to create users within the personnel database space, but not to modify or drop users within the personnel database (except for users that Phan created).

GRANT USER
ON personnel
TO phan;

Example: Granting Privileges Related to Triggers

The following request grants CREATE TRIGGER and DROP TRIGGER privileges to user TrigUser for any table in database TrigDB:

GRANT CREATE TRIGGER, DROP TRIGGER
ON TrigDB
TO TrigUser;

The following request grants CREATE TRIGGER and DROP TRIGGER privileges to user TrigUser for TrigDB as the subject table.

GRANT CREATE TRIGGER, DROP TRIGGER
ON TrigTable
TO TrigUser;

You can also grant the same privileges as in the previous requests using the short form TRIGGER to mean both CREATE TRIGGER and DROP TRIGGER.

For example:

GRANT TRIGGER
ON TrigDB TO TrigUser;

GRANT TRIGGER
ON TrigTable
TO TrigUser;

Example: Granting Privileges on an External Function

The following GRANT requests grant the following respective privileges:
  • ALTER FUNCTION on the specific external function find_text to users named user_dba and user_in_house.
  • ALTER FUNCTION on all external UDFs in the SYSLIB database to user_dba.
  • CREATE FUNCTION on the database document_db to user_dba.
  • EXECUTE FUNCTION on the overloaded function text_process to user sammy.
GRANT ALTER FUNCTION
ON SPECIFIC FUNCTION find_text
TO user_dba, user_in_house;

GRANT ALTER FUNCTION
ON syslib
TO user_dba;

GRANT CREATE FUNCTION
ON document_db
TO user_dba, user_in_house;

GRANT EXECUTE
ON FUNCTION text_process(CHAR,CHAR,INTEGER)
TO sammy;