SET Database Object Mode statement
Use the SET Database Object Mode statement to change the filtering mode of constraints and of unique indexes, or to enable or disable constraints, indexes, and triggers, or to bypass referential-integrity checking of constraints while this statement is resetting the constraint mode.
This statement is an extension to the ANSI/ISO standard for SQL. To specify whether constraints are checked at the statement level or at the transaction level, see SET Transaction Mode statement.
Syntax
Usage
In the context of this statement, database object has the restricted meaning of an index, a trigger, or a constraint, rather than the more general meaning of this term that the description of the Database Object Name segment defines in Other syntax segments.
The scope of the SET Database Object Mode statement is restricted to constraints, indexes, or triggers in the local database to which the session is currently connected. After you change the mode of an object, the new mode is in effect for all sessions of that database, and persists until another SET Database Object Mode statement changes it again, or until the object is dropped from the database.
Object modes for triggers, indexes and constraints
- Enabled (specified by the
ENABLED
keyword) - Disabled (specified by the
DISABLED
keyword)
- filtering without integrity-violation errors (by the
FILTERING WITHOUT ERROR
keywords) - filtering with integrity-violation errors (by the
FILTERING WITH ERROR
keywords)
- enabled, but without checking for integrity-violation errors (by the
ENABLED NOVALIDATE
keywords) - filtering with integrity-violation errors, but without checking for integrity-violation errors
(by the
FILTERING WITH ERROR NOVALIDATE
keywords) - filtering without integrity-violation errors, but without checking for integrity-violation
errors (by the
FILTERING WITHOUT ERROR NOVALIDATE
keywords).
At any given time, an object must be in exactly one of these modes. These modes, which are sometimes called object states, are described in the section Definitions of Database Object Modes.
The sysobjstate system catalog table lists all of the constraint, index, and trigger objects in the database, and the current mode of each object. Because the NOVALIDATE modes persist only during the SET CONSTRAINTS statement or ALTER TABLE ADD CONSTRAINT statement that specified that mode, the sysobjstate table ignores NOVALIDATE modes, which suppress violation-checking only within those DDL statements. For information on the sysobjstate table, see the Informix® Guide to SQL: Reference.
In cluster environments, the SET Database Object Mode statement is not supported on updatable secondary servers. (More generally, any session-level index, trigger, or constraint modes that the statement specifies are not redirected for UPDATE operations on table objects in databases of secondary servers.)