Generalized method for modeling complex ordered check constraints in a relational database system
First Claim
1. In a relational database system for storing data in multiple rows of a relational database table, each of said rows consisting of one or more columns, apparatus for defining and enforcing one or more ordered check constraints for said table, said apparatus comprising, in combination,means for accepting the definition of an ordered check constraint from a user, said definition consisting of the specification of a sort order in which said rows may be sequenced and the specification of a logical relationship between data values stored in at least one column in a given row of said table and data value stored in at least one column of the row which is adjacent to said given row when said given row and said row adjacent to said given row are sequenced in said sort order, processing means for evaluating the data values in adjacent pairs of rows of said table to determine whether the data values in said adjacent rows satisfy said logical relationship, and means for generating a failed constraint indication whenever said processing means determines that a pair of adjacent rows in said table do not satisfy said logical relationship.
3 Assignments
0 Petitions
Accused Products
Abstract
A system for enabling a user of a relational database to define and enforce ordered check constraints to insure that defined logical relationships are maintained between data values in pairs of adjacent rows when adjacency is defined by some ordering of the data. These inter-row conditions, here called “ordered check constraints,” are expressed by a logical expressions which define a required relationship between the attributes of a given row and its adjacent row or rows. Arbitrarily complex expressions involving these sets of attributes can be formed to model the constraints of interest. These expressions can be created by the database in support of, for example, traditional primary key or uniqueness constraints, or they can be provided by the database user to model new more complex constraints such as a requirement that there be no gaps in a list of serial numbers. These constraints can then be efficiently supported in the presence of a b-tree or another ordered index structure by identifying any inserted, updated or deleted rows and evaluating the expression in the context of those rows and any associated adjacent rows. This approach is similar to that typically used in existing database systems to support primary key and uniqueness constraints, providing the user with the ability to model a much richer set of constraints using a generalized expression which extends and enhances the functionality of check constraints to permit relationships of data in different rows to be defined and enforced.
-
Citations
16 Claims
-
1. In a relational database system for storing data in multiple rows of a relational database table, each of said rows consisting of one or more columns, apparatus for defining and enforcing one or more ordered check constraints for said table, said apparatus comprising, in combination,
means for accepting the definition of an ordered check constraint from a user, said definition consisting of the specification of a sort order in which said rows may be sequenced and the specification of a logical relationship between data values stored in at least one column in a given row of said table and data value stored in at least one column of the row which is adjacent to said given row when said given row and said row adjacent to said given row are sequenced in said sort order, processing means for evaluating the data values in adjacent pairs of rows of said table to determine whether the data values in said adjacent rows satisfy said logical relationship, and means for generating a failed constraint indication whenever said processing means determines that a pair of adjacent rows in said table do not satisfy said logical relationship.
-
7. In a relational database system for storing data in multiple rows of a relational database table, each of said rows consisting of one or more columns, the method for defining and enforcing one or more ordered check constraints for said table, said method comprising, in combination, the steps of
accepting the definition of an ordered check constraint from a user, said definition consisting of the specification of a sort order in which said rows may be sequenced and the specification of a logical relationship between data values stored in at least one column in a given row of said table and data value stored in at least one column of the row which is adjacent to said given row in said sort order, evaluating the data values in adjacent pairs of rows of said table to determine whether the data values in said adjacent rows satisfy said logical relationship, and generating a failed constraint indication whenever a pair of adjacent rows in said table do not satisfy said logical relationship.
-
13. The method of defining and enforcing adherence to a specified logical relationship between the data content in different rows of a relational database table which comprises, in combination, the steps of:
-
specifying a predetermined ordering sequence for the rows of said table, specifying a condition which defines a logical relationship that must exist between the data content of adjacent rows in said table when said rows are ordered in accordance with said predetermined ordering sequence, accepting changes to the data in said table in the form of one or more additions or modifications to the data contained in a given row of said table, in response to the acceptance of said changes, comparing the data content in one or more pairs of adjacent rows of said table which include said given row, generating a fault indication whenever said step of comparing determines that said condition is not satisfied by the data content in one of said pairs of rows. - View Dependent Claims (14, 15, 16)
-
Specification