Techniques for doing optimistic constraint checking in a versioned relational
database system. The techniques find a subset of the versions of a table that contain
all of the rows that need be checked for violation of a constraint when a given
version is modified. When the versions of a table are organized into a directed
acyclic graph (DAG), the subset for a given version is the ancestry of the given
version, that is, the given version plus the ancestors of the given version in
the DAG. Within the ancestry, the set of rows that must be checked is termed the
version view. A row that belongs to the set has a primary key that is the latest
version of the primary key in the given version's ancestry. The technique may be
used for constraints including the referential integrity constraint and the unique
key constraint. The metadata used to compute the version view is disclosed, as
well as the manner in which the constraint checking techniques interact with the
workspaces that provide access to the versions. The workspaces may be organized
as a DAG. The manner in which the workspaces are organized determines how changes
are propagated in the versioned relational database and thus the versions whose
ancestry has to be checked for constraint violations.