Informix Error -973: Cannot insert from the violations table to the target table.
Cause and resolution
Cannot insert from the violations table to the target table.
The user issued a statement that attempts to insert rows from the violations table into the target table. For example, the user enters the following statement:
INSERT INTO mytable SELECT * FROM mytable_vio
If the target table has some filtering-mode objects, this error is returned to the user. The user can recover in any of the following ways:
* Set the object mode of the filtering objects to some other mode.
* Stop the violations table.
* Insert rows from the violations table into a temporary table, and then insert rows from the temporary table into the target table.
Oninit® Troubleshooting Guidance
Reasons / Common Causes
-973 fires specifically on INSERT ... SELECT statements that try to move rows straight from a
violations table back into the target table it belongs to, when that target still has
filtering-mode objects in place.
INSERT INTO <table> SELECT * FROM <table>_vio(or equivalent) issued while the target table has one or more objects in filtering mode, per the official guidance — the direct, named trigger.- Not having changed the object mode, or stopped the violations table, before attempting the copy-back — per the official guidance's framing, this is what makes the insert unsafe: rows already known to violate the table's constraints would immediately re-trigger the same filtering behavior.
Solutions / Resolution
Per the official guidance, any of the following recovers:
- Set the object mode of the filtering objects to some other mode (e.g. disabled or enabled) before inserting from the violations table.
- Stop the violations table for the target table before inserting from it directly.
- Insert via a temporary table: copy rows from the violations table into a temporary table,
correct them there if needed, then insert from the temporary table into the target table —
this avoids ever running an
INSERT ... SELECTdirectly against the violations table while filtering mode is active.
Examples
The blocked direct copy-back
INSERT INTO mytable SELECT * FROM mytable_vio;
-- -973: Cannot insert from the violations table to the target table.
-- (mytable still has a filtering-mode object)
The documented workaround
CREATE TEMP TABLE mytable_fix AS SELECT * FROM mytable_vio;
-- correct rows in mytable_fix as needed
INSERT INTO mytable SELECT * FROM mytable_fix;
Diagnostic Checks
- Confirm which objects on the target table are currently in filtering mode.
- Confirm whether the violations table for the target is still active (started via
START VIOLATIONS TABLE).
Related Errors / Related Topics
- -971 — "Integrity violations detected." The error that populates the violations table -973 is trying to copy rows back out of.
- -975 — "Invalid object and object mode combination." The broader rule about object/mode pairings that -973 is a specific, violations-table-scoped case of.
Route the copy-back through a temporary table, or change the object mode first — inserting straight from the violations table while filtering mode is active is what -973 blocks.