Consultor Eletrônico



Kbase P26455: What is Referencial Integrity
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   04/06/2003
Status: Unverified

GOAL:

What is Referencial Integrity

FIX:

REFERENTIAL INTEGRITY

Referential integrity means ensuring that all foreign keys fields can be resolved to a valid entry in an associated table.

This implies that when these foreign key fields are populated a check must be made to ensure the valid entry exists. If an entry is deleted then a check should be made for entries in any table that may use its fields as foreign keys.

If such relations exist then the deletion should be disallowed.
Typically referential integrity checks must be put in place when:

1. a value is input to a foreign key field during user interaction
2. an entry is written to the database
3. an entry is being deleted

Using triggers can make sure Referential Integrity is always maintained.

Referential integrity can carried out in three places, the data dictionary, database triggers (CREATE, FIND, ASSIGN, WRITE and DELETE) and the application code itself.

Use the DELETE trigger to enforce deletion integrity and audit and the WRITE trigger for audit.