Tom Johnston, Randall Weis
DM Direct, February 15, 2008
In this installment, we will begin a discussion of how temporal referential integrity (RI) may be enforced with today's relational database management systems (RDBMSs). In addition, we will expand the glossary which we began last time, in Part 19. Indeed, the glossary work has proven to be the major portion of the work done here in Part 20. This seems to be the right point in our series to begin formalizing the definitions of the terms we have introduced.
Object RI and Temporal RI: A Clarification
In Part 19, we said that by "object RI" we meant the normal DBMS-enforceable referential integrity, implemented by populating a column designated as a foreign key to table X with the value of one of the primary keys in that table. That was wrong, and is indicated as such in the glossary by shading that entry. A new corrected definition is also included.
On that basis, we went on to give the following definition of "temporal RI": If there is a temporal RI dependency from version table Y to version table X (not necessarily distinct), then no state of the database is valid in which any row in table Y is not object-RI linked to a row in table X, or in which the effectivity time period of a row in table Y is not wholly contained within the effectivity time period of its parent row in table X. No inserts, updates or deletes are valid that would transform a database into such a state.
As this discussion should make clear, our corrected definition of the term "object RI" does not require us to amend the above definition of "temporal RI."
Notice that in this definition, the dependent-on table (X) is itself a version table. Consequently, it contains no rows for objects, only rows for versions of objects. To illustrate, consider this schematic of a version table, also copied from Part 19. We also add a schematic of a dependent table which, in our ongoing example, is the Policy table.

Figure 1: Version Table Schema for Version Pattern 6
![]()
In the Policy table shown here, the notation (OFK) stands for object foreign key. The object mentioned in this definition is, in this example, a specific client. The client is represented by the OFK column client-nbr.
If the referenced table were itself an object table, and not a version table, then client-nbr would be a "normal" foreign key, not an OFK. It would contain a value that was unique in the designated primary key column of the referenced table, and its validity could be checked by the standard RI mechanism of the DBMS (see Glossary). But the definition specifically states that it is a definition that involves two version tables. Consequently, client-nbr in the referenced table, by itself, is not a complete primary key. So it is not something the DBMS can enforce.
So what does "object RI" mean when there is no unique object to refer to, when, whatever it is, it is not enforceable by a RDBMS? By the same token, what kind of foreign key is an OFK?
An OFK column contains the value of a unique object even though a table with that value as primary key does not exist. It is as if, instead of Figure 1, versioning were implemented as shown in Figure 2.

In the as-if situation depicted in Figure 2, these are the foreign key dependencies:
Policy Version table to Policy table.
Client Version table to Client table.
Policy table to Client table.
These RI dependencies are all object RI dependencies because in all cases, the table referenced by a foreign key is an object (a non-version) table. In addition, all these object RI dependencies can be enforced by the RDBMS. So to keep this distinction clear, we will use the term "standard RI" (or "RI" by itself) to mean RI among non-versioned tables. Standard RI is RI that is enforceable by the DBMS.
This leaves us free to redefine the term "object RI." We will now use it to mean a constraint that applies between a pair of tables, where the referenced (parent) table is a version table. In that referenced version table, one part of its primary key will be an identifier for the object whose version it is. In the referencing table, there is a column which is constrained to contain a value matching the object identifier part of a version in the referenced table which is current at the time the referencing (child) row was inserted. That column is what we are calling an OFK. In addition, if the referencing row is not in a version table, then an update in place can be applied to it, of course. If that happens, the object RI constraint requires that the new value put in the OFK column must match the object identifier in a version current at the time of the update.
The Glossary below contains the indicated corrections, and also includes new expressions not defined previously.
Glossary
Child table, child row. Y is a child table to X if and only if there is a foreign key dependency from Y to X. A row in Y is a child to a row in X if and only if the row in Y has a foreign key whose value is identical to the primary key value of that related row in X.
Current version, most recent version. A version of an object whose effectivity begin date is chronologically the latest across all non-future versions of that object, and whose effectivity end date is either unknown (represented by “12/31/9999”) or in the future.
- One source of such cases is when there is a business requirement to correct an error in a version table, but also to retain, as queryable history, the version discovered to be in error.
- Another source of such cases would be where one of a few number of things might be true of an object in a given time period, but we don’t know which one.
Effectivity time period. The period of time during which a version is regarded as the truth about an object.
Logical delete. A delete which marks the row as deleted, but leaves it in the table.
Episode. Each version Y of an object which does not supercede a version X current at the time Y is created begins an episode of an object.
Object foreign key (OFK). A column in a versioned table which contains the object identifier used by one or more rows in a (not necessarily distinct) version table.
Object referential integrity, object RI (revised). The constraint that when a row containing an OFK is inserted, the value in that OFK matches the value of the object identifier portion of a primary key in a (not necessarily distinct) version table.
Object table. A table whose rows represent persistent objects. Sometimes called a "non-versioned" table.
Parent table, parent row. X is a parent table to Y if and only if there is a foreign key dependency from Y to X. A row in X is a parent to a row in Y if and only if that row in Y has a foreign key whose value is identical to the primary key value of that row in X.
Physical delete. A delete which physically removes the row from its table.
Queryable history. Data about an object that was valid at some time in the past, which is no longer currently valid, but which is as easily and rapidly accessible as current data.
Standard referential integrity, standard RI. The referential integrity constraint among non-versioned tables that today's RDBMSs can enforce. Because we are calling these non-versioned tables "object tables," we erroneously equated object RI with standard RI in Part 19.
Supercede, supercession. In these articles, we use these terms to refer to the replacement of a current version with a new current version.
Temporal referential integrity, temporal RI. Referential integrity for versions, which consists of object RI plus the constraint that the effectivity time period for child rows are wholly contained with the effectivity time periods of their parent rows.
Version, version table. A table whose rows represent versions of persistent objects.
Wholly contained in (for effectivity time periods). Time period 2 is wholly contained in time period 1 if and only if the effectivity begin date of time period 2 is equal to or later than the effectivity begin date of time period 1, and the effectivity end date of time period 2 is equal to or earlier than the effectivity end date of time period 1.
Our ground-clearing that was needed before we discuss options for enforcing temporal RI is hopefully now complete. If it is, Part 21 will begin our discussion of those options.
Beyond these issues, we must also discuss temporal RI as it applies to future versions, to hypothetical versions and also to versions that correct errors in other versions. This will take us several installments further into this series, at which point we will resume our presentation of physical implementations of Version Patterns 4 and 5.
After that, we will begin our discussion of Version Patterns 6 and 7.
For more information on related topics, visit the following channels:
©2008 Data Management Review and SourceMedia, Inc. All rights reserved. SourceMedia is an Investcorp company. Use, duplication, or sale of this service, or data contained herein, is strictly prohibited.