3 Data Control
3 Data Control
Systems
M. Tamer Özsu
Patrick Valduriez
Involves:
View management
Security control
Integrity control
Objective :
Ensure that authorized users perform correct operations on the
database, contributing to the maintenance of the database
integrity.
Example 3.2 :
SELECT ENAME,PNO,RESP
FROM EMP, ASG
WHERE EMP.ENO = ASG.ENO
AND TITLE = "Syst. Anal."
Updatable
CREATE VIEW SYSAN(ENO,ENAME)
AS SELECT ENO,ENAME
FROM EMP
WHERE TITLE="Syst. Anal.“
Example 3.5
Non-updatable
CREATE VIEW EG(ENAME,RESP)
AS SELECT ENAME,RESP
FROM EMP, ASG
WHERE EMP.ENO=ASG.ENO
Main actors
Subjects (users, groups of users) who execute operations
Operations (in queries or application programs)
Objects, on which operations are performed
Checking whether a subject may perform an op. (operation)
on an object
Authorization= (subject, op. type, object def.)
Defined using GRANT OR REVOKE
Centralized: one single user class (admin.) may grant or revoke
Decentralized, with op. type GRANT
More flexible but recursive revoking process which needs the hierarchy
of grants
Precompiled constraints
Express preconditions that must be satisfied by all tuples in a
relation for a given update type
(INSERT, DELETE, MODIFY)
NEW - ranges over new tuples to be inserted
OLD - ranges over old tuples to be deleted
General Form
CHECK ON <relation> [WHEN <update type>]
<qualification>
Precompiled constraints
Domain constraint
CHECK ON PROJ (BUDGET≥500000 AND BUDGET≤1000000)
Transition constraint
CHECK ON PROJ (NEW.BUDGET > OLD.BUDGET AND
NEW.PNO = OLD.PNO)
General constraints
Constraints that must always be true. Formulae of tuple
relational calculus where all variables are quantified.
General Form
CHECK ON <variable>:<relation>,(<qualification>)
Functional dependency
CHECK ON e1:EMP, e2:EMP
(e1.ENAME = e2.ENAME IF e1.ENO = e2.ENO)
Constraint with aggregate function
CHECK ON g:ASG, j:PROJ
(SUM(g.DUR WHERE g.PNO = j.PNO) < 100 IF
j.PNAME = "CAD/CAM")
UPDATE PROJ
SET BUDGET = BUDGET*1.1
WHERE PNAME = "CAD/CAM"
AND NEW.BUDGET ≥ 500000
AND NEW.BUDGET ≤ 1000000
Type of u
insert R- empty
delete R+ empty
modifyR+ (R – R-)
Problems:
Definition of constraints
Consideration for fragments
Where to store
Replication
Non-replicated : fragments
Enforcement
Minimize costs
Individual assertions
Single relation, single variable
Domain constraint
Set oriented assertions
Single relation, multi-variable
functional dependency
Multi-relation, multi-variable
foreign key
Assertions involving aggregates