Sunday 16 October 2011

A Question of Inalienable Rights


In Teradata, rights on an object are automatically assigned to two entities – the creator of the object and the owner database of the object. The rights of the creator are explicit, i.e. the system explicitly adds 11 or so rows in the AccessRights (DBC.UserRights view) table when the insert statement is issued.

SELECT *
FROM dbc.userrights
WHERE tablename = 'TestTable';

 *** Query completed. No rows found. 

CREATE TABLE TestTable
(TableId INT);

 *** Table has been created. 

SELECT *
FROM dbc.userRights
WHERE tableName = 'TestTable';

 *** Query completed. 11 rows found. 8 columns returned.

DatabaseName                   TableName                      ColumnName
------------------------------ ------------------------------ -------------
partha                         TestTable                      All
partha                         TestTable                      All
partha                         TestTable                      All
partha                         TestTable                      All
partha                         TestTable                      All
partha                         TestTable                      All
partha                         TestTable                      All
partha                         TestTable                      All
partha                         TestTable                      All
partha                         TestTable                      All
partha                         TestTable                      All

REVOKE ALL
ON TestTable
FROM partha;

 *** Revoke accepted.

All explicit rights removed!
 
SELECT *
FROM dbc.userRights
WHERE tableName = 'TestTable';

 *** Query completed. No rows found. 

INSERT INTO TestTable(1001);

 *** Insert completed. One row added.
 *** Total elapsed time was 1 second.

Possible due to implicit ownership rights.

SELECT *
FROM TestTable;

 *** Query completed. One row found. One column returned. 

    TableId
-----------
       1001

As is evident even if the explicit rights are removed from the user, the rights of ownership are inalienable.

No comments: